Htmldb_get object in IF statement

Hi all,
I I need to use the return object of htmldb_get method in a if statement after I make my AJAX query. Something like below:
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=APP_PROC',0);
get.add('APP_ITEM',html_GetElement('P11_TEST').value)
gReturn = get.get();
if (gReturn=='0')
// do some stuff
I can get the value of gReturn by other means but need to use it in a IF statement. The gReturn will have a value of '0' or '1' outputted by the application process APP_PROC
The code in above gives invalid character error in IE. Anyone please guide me the right way to use gReturn in if statement? Thanks.
PS: I am definitely sure the issue is with the if(gReturn=='0') because if I do if (true) the rest of the javascript/ajax function executes without problem.
Edited by: AI on 29/03/2012 21:01

Adding a parameter to htmldb_Get is done through "addParam", not "add"?
Have you tried to put an alert of your return?
If you have firefox with firebug, look at the ajax call, look at your POST parameters, and look at your response. Maybe an error is being thrown instead of the number your expect?
extra-curricular: I don't know which version of apex introduced the $v function, but it'd write easier than html_GetElement: $v('pFlowId'), or $('#pFlowId').val()

Similar Messages

  • Please  tell me the difference between CREATE OBJECT & CREATE DATA ,statements in CRMTECHNICAL

    Please  tell me the difference between CREATE OBJECT & CREATE DATA ,statements in CRMTECHNICAL

    found it on my own . the best way to do this is use the RetriveLimitedHierTreeCommand  with a search on the taxonomy table.

  • "Region" field's label of Rental object address to "State"

    Hi Experts,
    I want to change  "Region" field's label of Rental object address to "State". Is there any way to get this done with out going by data element level.
    If it could be achieved by BDT, please guide the steps.
    Thanks in advance.
    Regards,
    CM

    Hi,
    Goto CMOD, Goto "Goto" in menu \ Text enhancements \ keywords \ change, enter the data element "REGIO", write your description.
    But this is not at all advisable bcz it reflects in all the screens of SAP wherever this field exist.
    As address fields almost uses by all modules, dont do any changes and try to convince the business.
    rgds,
    Srini

  • Object with multiple states and slider in folio are rasterized, settings seem correct.

    I am having trouble keeping An object with multiple text states from being rasterized, as well as a slider that is also rastering.
    I have read that you are supposed to set the folio and article up to be .pdf and that the slider should have the vector option chosen.
    I haven't found anything for the multi state object to for these settings.
    What happens is when I output the folio to Adobe Content Viewer, only the text in those items is rasterized. All other text is crisp. Tested on both iPad Mini and iPad Retina and the both are blurry.
    Is there a way to force the vector option? It seems even with the correct options selected it is still rastering the test in interactive elements.
    Thanks!

    Here is the MSO with the folio.
    Here is the Slider with folio overlays panel.

  • Using Date objects in SQL statements

    Hi, I am wondering if it is possible to use Date objects while trying to retrieve entries from an access database with fields set as "Date/Time" fields, as opposed to "Text"? If so, do I need to reformat it before inserting it into the SQL statement, or can I just leave it as a Date object, and call up the variable name?
    For example - "SELECT * FROM database WHERE startDate = ' " + dateObject + ' ". And do i need quotes round this value?
    Thanks in advance.

    I had some problems by just fetching a date and pushing it back to a MS SQL Database.
    I used the following reformating step to fix it:
    if (o instanceof Timestamp)
    String time = o.toString().substring(8,10)+"."+o.toString().substring(5,7)+"."+o.toString().substring(0,4)+" "+o.toString().substring(11,19);
    ht.put(columnName, time);
    o is the object i receve from the select statement and ht is a Hashtable where i put my data.
    To write the data back i now can use:
    UPDATE table SET columnname = 'valueOfColumn'
    This means i use the value i created above in Quotes to write it back.
    Format of Timestamp.toString() is something like yyyy-mm-dd hh:mm:ss.xx
    Format used by MS SQL (and i think by Access to) 'dd.mm.yyyy hh:mm:ss'

  • Object-oriented programming: state and behaivor

    First of all, sorry for my level english.
    In Object-Oriented programming, should an object save always some state?
    What about session stateless bean service? What is the sense?
    These objects have only behaivour and not state.
    Perhaps, the sense is that you can send a message to this object, in oposite of a static methods in utility class?
    Thanks and regards.

    I suppose you could argue that if it doesn't have any state, then it's not really an "object" in the OOP sense, but who cares, really.
    Personally, I use state and behavior as a way to help clarify the responsibilities of various classes in the system, and if I see a codebase with a lot of objects with state but no behavior or behavior but no state, then it's a a red flag that it's a messy, poorly-thought-out design (and it usually turns out to be exactly that). The whole point of OOP (IMHO) is encapsulation, and bundling state and behavior together makes things encapsulated (you can prove that state changes only in certain areas in certain circumstances). Encapsulation makes for more easily maintainable code.
    It's easy to spot the blue squares in a Mondrian. It's difficult to spot the blue bits in a Pollock. The former is well-encapsulated OOP and the latter is poorly-encapsulated spaghetti code.
    That said, it's not the end of the world if you have a static utility class here and there.

  • Type of object in if statement

    Hello i have a function that needs to know if the object is either a block01 or a block02.
    if i trace the object in particular i get [object block01]  and [object block02] just as i want. but if i try to use the same thing in an if statement it isn't working. my code:
    blocks is an boolean array and blocks2 is an array with sometimes block01 and sometimes block02
    i have left away the array parts because they're not necesserily
    if (blocks[...]) {
                        trace(blocks2[...])
                         if(blocks2[...]==block02) {
                                                                 trace("ok")
                          removeChild(blocks2[...]);
                          blocks[...]=false;

    here's another:
    if(flash.utils.getQualifiedClassName(block)=="block01"){
    // p.s. please mark helpful/correct responses.

  • How to pass Array of Java objects to Callable statement

    Hi ,
    I need to know how can I pass an array of objects to PL/SQL stored procedure using callable statement.
    So I am having and array list of some object say xyz which has two attributes string and double type.
    Now I need to pass this to a PL/SQL Procedure as IN parameter.
    Now I have gone through some documentation for the same and found that we can use ArrayDescriptor tp create array (java.sql.ARRAY).
    And we will use a record type from SQL to map this to our array of java objects.
    So my question is how this mapping of java object's two attribute will be done to the TYPE in SQL? can we also pass this array as a package Table?
    Please help
    Thanks

    I seem to remember that that is in one of Oracle's online sample programs.
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/index.html

  • EOFException when deserializing object in if statement

    Hi,
    I'm a java newbie and I've got a program in which I've got an method to open a serialized file.
    I am running into problems when determining the class of the object to be deserialized.
    When the code is as such everything works fine:
        ObjectInputStream ois;
        protected void open() {
            int returnVal = fc.showOpenDialog(this);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                try {
                 ois = new ObjectInputStream(new FileInputStream(file));     
              frameSeqA72 = (SeqA72) ois.readObject();
              getContentPane().add(frameSeqA72);
              frameSeqA72.setVisible(true);
              ois.close();                                                                                                           
             catch (IOException ioe) {ioe.printStackTrace();}
             catch (ClassNotFoundException cnfe) {}     
        }For some reason I don't understand everything changes when I use an if statement in the code as follows:
        ObjectInputStream ois;
        protected void open() {
            int returnVal = fc.showOpenDialog(this);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                try {
                 ois = new ObjectInputStream(new FileInputStream(file));     
              if (ois.readObject() instanceof SeqA72) {
                  frameSeqA72 = (SeqA72) ois.readObject();
                  getContentPane().add(frameSeqA72);
                  frameSeqA72.setVisible(true);
                  ois.close();                                                    
             catch (IOException ioe) {ioe.printStackTrace();}
             catch (ClassNotFoundException cnfe) {}     
        }An EOFException is thrown when this method is called -
    "EOFException at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1267)..."
    My serialized objects are of different classes so I want to determine the class before casting...so Im using "if (ois.readObject() instanceof SeqA72)".
    Why would the first version work and the second throw an exception?
    Am I going about this in a bad way?
    Casey

    You're calling readObject twice, so it's trying to read two objects.
    Read it once and save a reference in a variable. Use that variable, instead of calling readObject again.

  • Bogus Invalid Object in MERGE Statement

    Let me begin by saying that I have been working with MERGE since its inception, and I am familiar with the fundamental gotcha's. This problem is more inexplicable. (It's one of those things that I expect, when someone explains it, will be a DOH! moment.)
    I am building a one-time conversion script to merge an existing User table with a new User table. Since I am only in the development mode, I didn't want to modify the true table yet. So I made a copy of the table to work with, using the following familiar
    syntax.
    SELECT *
    INTO uam.User2
    FROM uam.[User]
    Imagine my surprise when the MERGE statement refused to recognize uam.User2 - although it recognizes uam.[User] just fine.
    In the interests of competeness, here is the MERGE Statement in question.
    MERGE  uam.[User2]
    as tgt
    USING (SELECT
    UserID
    ,FirstName
    ,LastName
    ,CompanyID
    ,AuthenticationID
    ,isActive
    ,PrimaryEmailID
    ,CreatedByUserName
    ,CreatedByDtim
    ,@User
    _User
    ,GETDATE()
    _GETDATE
    FROM #User
    ) as src
      ON tgt.UserID = (src.UserID * -1)
    WHEN NOT MATCHED
    THEN
    INSERT
    (FirstName
    ,LastName
    ,CompanyID
    ,AuthenticationID
    ,isActive
    ,PrimaryEmailID
    ,CreatedByUserName
    ,CreatedByDtim
    ,LastUpdatedUserName
    ,LastUpdatedDtim
    VALUES
    (src.FirstName
    ,src.LastName
    ,src.CompanyID
    ,src.AuthenticationID
    ,src.isActive
    ,src.PrimaryEmailID
    ,src.CreatedByUserName
    ,src.CreatedByDtim
    ,_User
    ,_GETDATE
    OUTPUT INSERTED.UserID
    ,tgt.UserID
    INTO #UserMapping;
    The procedure refuses to run, flagging the tgt.UserID as 
    Msg 4104, Level 16, State 1, Line 140
    The multi-part identifier "tgt.UserID" could not be bound.
    SSMS also flags the uam.[User2] on the MERGE line as "Invalid object name 'uam.User2'" on mouse-over.
    A few notes:
    I have a SELECT * FROM uam.User2 immediately before this MERGE, and it works just fine. And yes, it returns a UserID column.
    If I change the name from uam.User2 to uam.[User], it works just fine.
    I know the JOIN is a little strange (I really wanted just an INSERT where I could see the original UserID and the newly inserted UserID together, and INSERT will not let me OUTPUT directly from a table - hence the MERGE), but I also tried it with a straight-up
    tgt.UserID = src.UserID. Nothing changed about the errors.
    I also went back and re-created the uam.User2 table directly from the code that built uam.[User]. Nothing changed.
    I'm flummoxed. This has all the earmarks of a "well-that-was-dumb" coding error, but for the life of me I cannot see what would change between using these two tables, since one is a copy of the other...
    Any insight would be much appreciated!
    Duncan Davenport

    OK, I have it.
    DOH!  (told ya)
    So, while intellisense (typically) flags this table as not existing, that's just Intellisense doing the nonsense it always does. This obfuscated the ACTUAL error - which was the wrong schema defined in the output clause. The error itself pointed at the wrong
    line (nothing new there either). Once I fixed the OUTPUT clause, everything worked as expected - although SSMS is still putting squiggly red lines under everything that is working anyway. Yeah, we've all seen THAT behavior - no big deal.
    Anyway, that's the answer. It's magic - in that the error messages specialize in misdirection :)...
    Closing this. (I wonder if I get credit for answering my own question?)

  • Moving an object for certain states?

    I want to move an object for about 5 of my states but leave it where it is for about 5 other states.
    What is the best way to do this?
    I don't really want to try and move it the same distance every time. Is there a way to move something that it does the same thing for certain other states?

    Hello,
    The exact manipulations you are looking for are not available in Catalyst. Here are some (partial) workarounds.
    To make an object the same in StateY as in StateX, you can remove it from StateY and then share it from StateX. This can mess with animations attached to the object, so be mindful of that.
    You can create multiple default transitions of a given length by selecting the transitions in the timeline, and clicking the disclosure arrow by "Smooth Transition".
    -Bear

  • After System copy all objects become modified state in Dev and Quality .

    Hello All.
    we have 5 source systems, recently we did system copy for 4 source systems but only one system alone not participated.
    so now all objects in  SS become modified state in development and quality.
    earlier in Sys copy i faced the same problem in quality i will do the transport form dev to quality. but now in development itself its in modified state how can activate it?
    Thank you!
    Regards,
    Ranga
    Edited by: Ranga123 on Jan 10, 2012 5:57 PM

    Hi,
    Looks like system copy is not performed correctly.
    But there are options like
    go to source system
    myself BW system right click actiuvate and replicate option
    similarly for SAP R/3 source system.Right click and activate
    then there are other transactions in case there are specific objects to be activated
    RSDG_CUBE_ACTIVATE
    RSDG_IOBJ_ACTIVATE
    SO ON
    Thanks

  • Can you set arraycollection objects to certain states?

    hey guys.. so in my application, i need to setup rules and permissions for certain users...
    so basically my applicaion initially displays a login screen, on login success its going to get a variable from the server which says if the user has all or video access
    the way i have my "login success" component setup is i have an array collection and i have states
    basically if the user has "all" access then the user shoudl be able to see everythign in that array collection. and if the user has "video" access the the user shoudl onlly see the video option in the list
    the code i have is
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <s:ArrayCollection id="webCoreSourceData">
                   <fx:Object label="Content Group" stackId="contentGroup" />
                   <fx:Object label="Images" stackId="images" />
                   <fx:Object label="Image Renderer" stackId="imageRender" />
                   <fx:Object label="Videos" stackId="videos" />
                   <fx:Object label="Flash Objects" stackId="flashObjects" />
                   <fx:Object label="Story Editor" stackId="storyEditor" />
                   <fx:Object label="Tag Management" stackId="tagManagement" />
                   <fx:Object label="Image and Video Format" stackId="format" />
                   <fx:Object label="Rules And Permissions" stackId="rulesAndPermissions" />
              </s:ArrayCollection>
         </fx:Declarations>
         <s:states>
              <s:State name="all" />
              <s:State name="videoUpload" />
              <s:State name="imageUpload" />
              <s:State name="contentGroup" />
              <s:State name="flashObjects" />
         </s:states>
            <list dataprovider="webCoreSourceData" />
    i need to set each one of these arraycollection objects to a certain state, so when i set "currentState=videoUpload" then only video displays in the list component
    and when i set my "currentState="all"" then i want to be able to all the objects in the arraycollection
    any help is greatly appretiated!! thank you...

    Hi,
    There are a few things you can do, one is to filter the array on change of state you could have it that your dataprovider is different for each state then you do something like below. This might give you some sort of direction anyway..
    David
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
    <![CDATA[
    import mx.events.FlexEvent;
    ]]>
    </fx:Script>
    <s:states>
    <s:State name="State1"/>
    <s:State name="ImageState"/>
    <s:State name="VideoState"/>
    <s:State name="OtherState"/>
    </s:states>
    <fx:Declarations>
    <s:ArrayCollection id="Videos">
    <fx:Object label="Video1" />
    <fx:Object label="Video2" />
    <fx:Object label="Video3" />
    <fx:Object label="Video4" />
    </s:ArrayCollection>
    <s:ArrayCollection id="Images">
    <fx:Object label="Image1" />
    <fx:Object label="Image2" />
    <fx:Object label="Image3" />
    <fx:Object label="Image4" />
    </s:ArrayCollection>
    <s:ArrayCollection id="OtherStuff">
    <fx:Object label="OtherStuff1" />
    <fx:Object label="OtherStuff2" />
    <fx:Object label="OtherStuff3" />
    <fx:Object label="OtherStuff4" />
    </s:ArrayCollection>
    <s:RadioButtonGroup id="radiogroup1"/>
    </fx:Declarations>
    <s:List id="myList" x="163" y="85" width="271" height="386"
    dataProvider.VideoState="{Videos}"
    dataProvider.ImageState="{Images}"
    dataProvider.OtherState="{OtherStuff}"/>
    <s:Button y="15" label="Video" x="160" click="currentState='VideoState'"/>
    <s:Button y="15" label="Image" x="240" click="currentState='ImageState'"/>
    <s:Button y="15" label="Other" x="320" click="currentState='OtherState'"/>
    </s:Application>

  • Htmldb_Get() not updating session state?

    Thankfully, I solved this problem myself before posting this, but I still have questions about why I ran into the problem in the first place.
    Alright, I have a javascript controlled interface on an ApEx page that uses htmldb_Get() for retrieving the current state of a row in the database and for submitting the data back to a page process to update the database row. I've checked my values from the javascript function that saves the data and the strings do contain the updated text from the interface, but when my page process fires off the strings have reverted to what was in the session state from the earlier AJAX request when the interface was loaded.
    * I've checked the session state and the variables in question are reverted, but I noticed that the item statuses are listed as "Updated".
    * I've also tested this process by passing the request string and page items in the URL and the process functions correctly.
    * I've double checked the item definitions to see if the items were being overwritten (they weren't).
    * I've checked the item types to make sure that none were "protected" (they weren't).
    * I haven't found any error messages in logs within ApEx.
    At this point I noticed that the AJAX requests to load the interface were showing up in the "Recent Page Views" report, but the save requests were not. For no particular reason I decided to switch from using the request string in the conditional for the page process and use a page item to control the mode as so...
    WAS:
    var get = new htmldb_Get(null,$x('pFlowId').value,'save_asset_tracking_info',11);
    NOW:
    var get = new htmldb_Get(null,$x('pFlowId').value,'',11);
    get.add('P11_FORM_MODE','save_asset_tracking_info');
    ...and magically the page items in the session state are being updated and all is well. There are few things more frustrating than spending hours debugging a process, then fixing it with an action that you are completely convinced won't change a thing.
    This make no sense to me and I'm hoping someone can explain it or at least point me in the right direction.
    Thanks in advance,
    Jason

    Apologies if I skipped a few details in my first post...
    I haven't included much of my source code because I don't believe it's the key to this issue. If you disagree, I will post the source code for your reference.
    On page 10 of my application, I have a floating div interface that appears in front of the page content. This div is initially empty, but I use JavaScript to make an AJAX call to page 11, strip out a specific region using the get.get() function. On the floating interface, there is a "save" button that fires off another JavaScript function that uses htmldb_Get() and get.add() to post all 21 of the items from the floating interface back to a page process on page 11. The "save" page process is at process point "on load - before header" and is extremely simple -- "if ID found then update record, else insert record".
    The problem I had was that after the "save" button was pressed, all of the items sent via AJAX to the page process were always identical to the initial values from when page 11 was rendered and the floating div interface was populated. This seemed like some sort of quirk or issue with the session state cache overwriting the values that were being sent via AJAX. As I said before, I checked the values in JavaScript immediately before the AJAX "save" submission and everything was kosher, but the page process never got those updated values.
    I managed to eliminate this "symptom" by simply...
    1. Setting the htmldb_Get() request string to null ("")
    2. Adding one more get.add() call for P11_FORM_MODE
    3. Changing the condition on which the page process was fired from the request string to the page item
    All of the other get.add() calls remained the same as did the PL/SQL in the page process.
    Thanks,
    Jason

  • Date objects and prepared statements

    Hi, I am trying to parse a String into a Date object with format "dd/MM/yyyy hh/mm/ss". Anyway, i have a method in a separate class which reads in a String and converts it to a formatted Date object.
    static public Date convertToDate(String t) throws ParseException {
    Date dd = new Date();
    ParsePosition p = new ParsePosition(0);
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
    //y, M, etc are retrieved as substrings of String t. I know these methods are deprecated as well
    dd.setYear(y);
    dd.setMonth(M);
    dd.setDate(d);
    dd.setHours(h);
    dd.setMinutes(m);
    dd.setSeconds(s);
    String formattedDate = formatter.format(dd);
    Date theDate = formatter.parse(formattedDate);
    return theDate;
    Anyway, I am trying to use this in an SQL statement because I am using an Access DB which has a field of Date/Time value. Is this correct to use a Date object then? I have a prepared statement -
    PreparedStatement query = connection.prepareStatement(
    "SELECT FText FROM wnioutput WHERE Id = ? AND Section = ? AND Start = " +
    "? AND Field = ?");
    //start is the Date object returned from the previous method in a separate class
    query.setInt(1, id);
    query.setInt(2, section);
    query.setDate(3, formattedStart); - with this part, i get a setDate method not found, or something
    query.setString(4, ch);
    Can anybody tell me what the problem is? I know there are Date objects of java.util and java.sql. Should i be using an sql Date object? And if so, how, and where do I do this? Thank you!

    ok, i just tried
    query.setTimestamp(3, new java.sql.Timestamp(formattedStart.getTime()));
    where formattedStart is a java.util.Date object
    and I get the following error message -
    Error occured in getting endDateAndTime: java.sql.SQLException: Exception in databaseDisplay: the error message is:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    java.lang.NullPointerException
    where endDateAndTime is
    // takes in the startDateAndTime as a formatted String (before it is converted into a Date object)
    public String getEndTime(int s, int ID, String stDateAndTime) {
    String end = null;
    gui g = new gui();
    try {
    String sql = "SELECT End FROM wnioutput WHERE Id = " + ID +
    " AND Section = " + s +
    " AND Start = '" + stDateAndTime + "' AND Field = 'Wind50m'";
    ResultSet result = g.queryDatabase(sql);
    if (result.next())
    end = result.getString("End");
    } catch (SQLException sqlex) {
    System.out.println("Error occured in getting endDateAndTime: " + sqlex.toString());
    return end;
    Although this method worked fine before. So the error is in setting the date object in the prepared statement. Anymore suggestions??

Maybe you are looking for