Set value with XPath dynamically #2

I am running into a similar problem as
http://forums.adobe.com/message/2953296#2953296
.but instead of constructing a string from xpath expressions, I'm trying to store a value into a Location based on a concatenated xpath expression.
Here is what I'd like to do but it doesn't work:
/process_data/@Approver_index = 1
Location:/process_data/formData_flat/xdp/datasets/data/TDCR/RoutingName_[number(/process_data/@Approver_index)]
Expression: 'Bob'
This works if you were to put the string into the Location but Workbench won't accept this as a Location.  How can I dynamically apply a template xpath expression?  Any help would be great.

Thanks for responding Gil.  This article is the basics of how to use the ExecuteScript service.  I'm familiar with this service.  Specifically, I'm trying to dynamically generate an XPATH location to store data.  Since I don't have a background as a java developer, I'm having trouble figuring out the method to accomplish this.
The link I originally quoted was helpful because it outlined how to dynimcally build the Expression (which I also need ...and actually got working) but it doesn't mention how to build the XPATH location.  For this operation, I need to dynamically build both the Expression and the Location.  I'm halfway there.

Similar Messages

  • Set value with XPath dynamically

    Dear All,
    I am wonder if the following is possiable with Set Value service using XPath, any *simple* workaround is also welcome too.
    If I have a variable myXML =
    <root>
    <item region="One">1</item>
    <item region="Two">2</item>
    </root>
    I can reference to /root/item[1] by:
    set /process/@myNum = 1
    set /process/@dummy  = /process_data/myXml/root/item[number(\process\@myNum)]
    But how can I access /root/item[@region="One"] ?
    I tried the following but all failed:
    1)
    set /process/@myString = @region="One"
    set /process/@dummy  = /process_data/myXml/root/item[string(\process\@myString)]
    2)
    set /process/@myString = One
    set /process/@dummy  = /process_data/myXml/root/item[@region='string(\process\@myString)']
    And are there any way to set a variable using template string? (i.e. You name is {$/process/@yourName$} )
    Regards
    Bill

    Bill,
    As the nature of dynamic xPath statements is very use-case dependant, there is not much in the way of documentation. However, I will forward this thread to the documentation team to see if there is anything that can be added in the future to make these types of questions covered in the docs.
    As for setting a variable by using a template, there is no way to do this in setValue service unfortunately. However, you can use the executeScript service in LC ES. This service allows you to write java code and have access to the LC ES APIs while in context of your process. If you go to http://help.adobe.com/en_US/livecycle/9.0/workbenchHelp/help.htm and look under Creating Processes Using LiveCycle Workbench ES2 / Service Reference / Execute Script you will find documentation about how ot use this service.
    http://help.adobe.com/en_US/livecycle/9.0/workbenchHelp/000580.html
    There is a method called replacePathExpressions(String aString) that is exposed by the patExecContext object. this method takes in a template like you are looking to use. Basically a string that contains some xPath expressions wrapped in {$ $}. I created a sample process (attached to this post) that has a process variable called templateString. I used a setValue service to set it's value to:
    "Your name is {$/process_data/@name$} and your address is {$/process_data/@address$}."
    Of course, I also have variables called "name" and "address" that I have tagged as input variables. Then I have the executeScript service with the following code (basically 3 lines of code with alot of comments):
    //Get the templateString process variable value.
    String template = patExecContext.getProcessDataStringValue("/process_data/@templateString");
    // Call the replacePathExpressions() method.
    // It is a built-in method that will look for all {$ $} variable text and process each xPath expression and replace them in the text.
    String result = patExecContext.replacePathExpressions(template);
    // Now, the result string contains all of the resolved xPath statements.
    // Let's set the process variable that will hold the result.
    patExecContext.setProcessDataStringValue("/process_data/@resultString",result);
    Now you can dynamically construct responses using template variables.
    Also, thanks to Florentin Wandeler for the tip on the replacePathExpressions() method.

  • XMLSearch / case in-sensitive search in a text node value with XPATH

    Hi everyone,
    I was aggregating some XML files and queries for a search
    engine. It is pretty easy with coldfusion XML functions BUT ....
    I was looking around XMLSearch to do a simple text search
    into nodes and I am stuck with it.
    with something like that :
    selectedElements = XmlSearch(myxmldoc,
    '(/directory/user[contains(.,"#form.firstName#")])');
    Without loop all the XML elements, I cannot put firstName
    text nodes to lower-case, do a simple search into the directory and
    get user entries.
    Is it possible to do with XPATH something like that :
    selectedElements = XmlSearch(myxmldoc,
    '(/directory/user[contains(lower-case(.),lower-case("#form.firstName#"))])');
    Thanks for your help.

    When Do you think coldfusion will implement Xpath functions
    as
    http://www.w3schools.com/xpath/xpath_functions.asp
    ????

  • Problem retrieving a list of values with XPATH

    Hi,
    I am trying to get a list of all 'Fields' (under the SubscriptionList -> EconomicIndicator -> Code) which have 'Provider' =DJ.
    I am using the below xpath expression. But It is not working. I tried other variations but none of them return mulitple items.
    Can some one please tell me if Iam missing something.
                   XPathExpression xPathExpression= xpath.compile("/SubscriptionList/EconomicIndicator[*]/Code[Provider=DJ]/Fields");
                   NodeList result = (NodeList)xPathExpression.evaluate(doc, XPathConstants.NODESET);
              for (int i = 0; i < result.getLength(); i++) {
                   Element element = (Element)result.item(i);
              System.out.println(element.getNodeValue());
    <?xml version="1.0" encoding="UTF-8"?>
    <SubscriptionList>
    <DefaultEconomicIndicatorName>US ADP Employment Change</DefaultEconomicIndicatorName>
    <!--GE IFO - Business Climate-->
    <EconomicIndicator>
    <Name>GE IFO - Business Climate</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-22T03:50:00</StartDate>
    <EndDate>2007-06-22T04:10:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>DEBUSS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>DJ</Provider>
    <Service></Service>
    <InstrumentCode>GM_IFO</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>GM_IFO_BUSSENTIMENT_Cur</Fields>
    </Code>
    <Code>
    <Provider>DJS</Provider>
    <Service></Service>
    <InstrumentCode>GM_IFO</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>GM_IFO_BUSSENTIMENT_Cur</Fields>
    </Code>
    </EconomicIndicator>
    <!--GE Producer Prices (MoM)-->
    <EconomicIndicator>
    <Name>GE Producer Prices (MoM)</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-20T01:50:00</StartDate>
    <EndDate>2007-06-20T02:10:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>DEPPI=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--UK CBI Industrial Trend-->
    <EconomicIndicator>
    <Name>UK CBI Trends - Orders</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-21T05:50:00</StartDate>
    <EndDate>2007-06-21T06:10:00</EndDate>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>GBCBIO=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--UK CBI Industrial Trend-->
    <EconomicIndicator>
    <Name>UK CBI Distributive - Trades</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-21T05:50:00</StartDate>
    <EndDate>2007-06-21T06:10:00</EndDate>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>GBCBIS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--US Unit Labor Costs-->
    <EconomicIndicator>
    <Name>US Unit Labor Costs</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-09-06T08:20:00</StartDate>
    <EndDate>2007-09-06T08:40:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>USLCTS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>DJ</Provider>
    <Service></Service>
    <InstrumentCode>US_PROD2_REV</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>US_PROD2_REV_UNITLABORCOST_CurQChgPct</Fields>
    </Code>
    <Code>
    <Provider>DJS</Provider>
    <Service></Service>
    <InstrumentCode>US_PROD2_REV</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>US_PROD2_REV_UNITLABORCOST_CurQChgPct</Fields>
    </Code>
    </EconomicIndicator>
    </SubscriptionList>

    Hi DrClap,
    I have a similar problem again. This time I am trying to extract a list of values from a xsd. Below is the code that I am using.
              try{
                   djxsd = new FileInputStream("djei-3.1.xsd");
                   XPathFactory factory = XPathFactory.newInstance();
                   XPath xpath = factory.newXPath();
                   SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
                   xpath.setNamespaceContext(nsContext);
                   nsContext.addNamespace("xs", "http://www.w3.org/2001/XMLSchema");
                   nsContext.addNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");
                   +//String exp = "//xs:element/@name/text()";+               
    String exp = "/xs:schema/xs:group/xs:sequence/xs:element";
                   XPathExpression xPathExpression= xpath.compile(exp);
                   NodeList result = (NodeList)xPathExpression.evaluate(doc, XPathConstants.NODESET);
                   FileOutputStream outputfile = new FileOutputStream("log.txt");
              for (int i = 0; i < result.getLength(); i++) {
                   Element element = (Element)result.item(i);
                   String output = element.getTextContent().trim();
                   if(output.length() > 0)
                        outputfile.write(output.getBytes());
                        //System.out.println(output);
    Highlighted in Itlalics is the actual expression that I want to use. For some reason this is not working .. it returns nothing.
    The other expression works. Please let me know if there is anything wrong with the expression.
    THE XSD FILE
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" elementFormDefault="qualified">
         <xs:element name="DJEconomicIndicator">
              <xs:complexType>
                   <xs:sequence minOccurs="0" maxOccurs="unbounded">
                        <xs:group ref="allgroup"/>
                   </xs:sequence>
                   <xs:attributeGroup ref="TopGrp-Attributes"/>
              </xs:complexType>
         </xs:element>
         <xs:group name="allgroup">
              <xs:sequence>
                   <!-- ==================== CPI ========================== -->
                   <xs:element name="US_CPI_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <xs:element name="US_CPI_ExpMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> Forecast MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <!-- ==================CPI Unrounded==================== -->
                   <xs:element name="US_CPI_Unrounded_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI UnRounded</xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <!-- ==================CPI Core Index==================== -->
                   <xs:element name="US_CPI_Core_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI Core </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <xs:element name="US_CPI_Core_ExpMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI Core </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> Forecast MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>

  • Error in setting value with prepareStament

    Dear Friends,
    I've a problem with prepareStatement while setting the value. Bellow i'm mentioning the error which i get while compiling. Could any please guide me what is the problem.
    String str="insert into prep (id,name,age,dob) values (?,?,?,?))";
    PreparedStatement pstmt=conn.prepareStatement(str);
    pstmt.clearParameters ();
    pstmt.setString(1,"dhananjay",28,"10/10/1975");
    pstmt.execute();
    pstmt.close();
    while compiling bellow error comes :-
    TLogin.java:214: setString(int,java.lang.String) in java.sql.PreparedStatement cannot be applied to (int,java.lang.String,int,java.lang.String)
    pstmt.setString(1,"dhananjay",28,"10/10/1975");
    ^
    Thanking you..
    Jayshri

    Thanx Tom for your reply,
    As you suggested i tried to use bellow code :
    PreparedStatement pstmt=conn.con.prepareStatement("insert into prep(id,name,age,dob) values (?,?,?,?)");
    pstmt.setString(1,1);
    pstmt.setString(2,"dhananjay");
    pstmt.setString(3,28);
    pstmt.setString(4,"10/10/1975");
    pstmt.execute();
    it gave me bellow error :
    TLogin.java:214: setString(int,java.lang.String) in java.sql.PreparedStatement cannot be applied to (int,int)
    pstmt.setString(1,1);
    ^
    TLogin.java:216: setString(int,java.lang.String) in java.sql.PreparedStatement cannot be applied to (int,int)
    pstmt.setString(3,28);
    ^
    so i changed the code to :
    PreparedStatement pstmt=conn.con.prepareStatement("insert into prep(id,name,age,dob) values (?,?,?,?)");
    pstmt.setString(1,"1");
    pstmt.setString(2,"dhananjay");
    pstmt.setString(3,"28");
    pstmt.setString(4,"10/10/1975");
    pstmt.execute();
    above got compiled without error but while executing it is not inserting row in table, because id and age is integer in database and here i'm passing as string.
    what i do to solve this problem?
    thanking you.
    Jayshri

  • Problems of setting values% with 2 decimal places in any graphics. What sho

    Guys, I have the xcelsius 2008 and can not make it work chart with values % and 2 decimal places. Already set up everything that I know the spreadsheet and graphics.
    Someone knows what can I do?
    Thanks Anderson - Sao Paulo - Brazil.

    Hi Anderson,
    To get values in % and upto two decimal, follow the below steps:
    Go to Chart properties-> Appearences Tab-> Text tab.
    Select the "Vertical Axis Labels" and go to the Number format present below in the window.
    Change the format to "Percentage" and set decimal places to "2".
    This should work.
    Please revert incase you have any queries.
    Thanks,
    Amit Mathur.

  • Reading more than one value with XPath and java 1.5

    Hello, I'm using XPath with Java 1.5 and I've some problems.
    I do these things:
    File xmlDocument = new File("c:/test.xml");
    InputSource inputSource = new InputSource(new FileInputStream(xmlDocument));
    XPathFactory factory = XPathFactory.newInstance();
    XPath xPath = factory.newXPath();
    int replication = Integer.parseInt(xPath.evaluate("/simulation/setup/replication", inputSource));
    System.out.println(replication); // THIS WORKS!
    warmuptime = Integer.parseInt(xPath.evaluate("/simulation/setup/warmuptime", inputSource));
    System.out.println(warmuptime); // THIS DON'T WORK: javax.xml.xpath.XPathExpressionException
    As I had written in the comments, the first time I call ".evaluate", it works, the second time it raises an exception.
    The Xml is correct! The string "/simulation/setup/warmuptime" is correct!
    I tryed to place a:
    xPath.reset()
    between the two "evaluate", but still doesn't work.
    Can you give me an help? or suggest me an url where these things are explained in a simple way?
    I just need to get some data from an XML file and XPath seems to be the quickest and easiest way.
    Thanks for the help.

    Are all the files in one directory? If so you can make a File object of the directory, get an array of all files in that directory (File has a method to do this). Then loop over your array and call a method that reads the File that you pass as a parameter.

  • Selecting attribute values with XPath?

    Dear all,
    Is it possible to retrieve the value of a certain attribute in an XML document using an XPath expression? For instance, if I have the following doc:
    <someTag>
       <anotherTag attr="123" />
    </someTag>Is there one XPath expression that will return the value of the attribute attr of the element anotherTag, i.e. "123"?
    Cheers,
    N.

    I think /anotherTag/@attr/text() does the job.

  • How to make dynamic actions using Set Value work in all browsers?

    I’m having a cross-browser incompatibility issue with dynamic actions using Set Value.  The dynamic action works like a charm on Chrome but has no effect on either IE or Firefox.  The code in oracle.apex.com and here are the credentials:
    Workspace: DDBA
    Username: [email protected]
    Password: redtruck12
    These code is on page 3 and here are the details:
    There are two report lists (Standard and Special) and some of the reports require additional information supplied in either select lists or text boxes.
    If the user selects a Standard report requiring a select list/text box, then the dynamic action sets the value of Special Reports to NULL (and vice-versa).
    The dynamic action is to prevent a simultaneous selection of both the Standard and Special reports.  To see how it works on Chrome, do this:
    Run Page 3
    Select the ‘Report for Search Criteria’ option from the Standard Report list.  A ‘Search Criteria’ text box appears
    Select the ‘Report by Release’ option from the Special Reports list.  A select list appears and the ‘Search Criteria’ text box disappears.
    If you do the same things on IE or Firefox, the text box does not disappear. 

    Hi,
    Things are going wrong with setting the item values to NULL. If you check your session state, you'll see that in chrome your items values indeed will be set to null, but in firefox they won't.
    Also I've noticed that you don't reset the other input fields, so their values persist in the session state. Since you submit your page every time you change one of the report select lists, this might lead to unexpected behaviour. Lastly, I've noticed you use a sql exists expression to manage the display/hide of your page items. A condition of type "Value of  expression 1 = expression 2" causes less overhead as you don't need to switch to the db sql engine for every item to validate.
    I'd suggest you rethink your specs and try to create:
    - One dynamic action (since a value of standard select excludes the value of special select, and vice versa)
    - Set the values for hidden items to null, also in session state
    - Use a refresh of region as extra event in your dynamic action, instead of submitting your page for every change.
    Regards,
    Vincent
    http://vincentdeelen.blogspot.com

  • Dynamic Action Set Value - PLSQL Error - cannot contain an expression

    I am trying to use below in a Dynamic Action to Set Value with PL/SQL Function. The dynamic action does not update the item appropriately. I tried to run the below directly in SQL Workshop but received the error "PLS-00372: In a procedure, RETURN statement cannot contain an expression". How can I get below to return the value needed?
    DECLARE
    rqstdaloe number;
    rqstdeloe number;
    devpercent number;
    rqsttarget date;
    timeleft number;
    PSPTime number;
    DevTime number;
    DevPer number;
    BEGIN
    SELECT SUM("TRACK_TIME_SPENT") INTO rqstdaloe
    FROM "TIME_TRACKER"
    LEFT JOIN "TBL_R66_TASK_TYPE" ON "TASK_TYPE_ID" = "TRACK_TYPE"
    WHERE "TRACK_REQUEST_ID" = :P2_REQUEST_ID AND "TASK_TYPE_TYPE" = 'DEV';
    rqstdeloe := :P2_REQUEST_ELOE;
    SELECT SUM(TT1."TRACK_TIME_SPENT") INTO DevTime
    FROM "TIME_TRACKER" TT1
    LEFT JOIN "TBL_R66_TASK_TYPE" TT2 ON TT1."TRACK_TYPE" = TT2."TASK_TYPE_ID"
    WHERE TT1."TRACK_USER" = :P2_PSP_ASSIGNED_PRIMARY AND TT2."TASK_TYPE_TYPE" = 'DEV';
    SELECT SUM(TT1."TRACK_TIME_SPENT") INTO PSPTime
    FROM "TIME_TRACKER" TT1
    WHERE TT1."TRACK_USER" = :P2_PSP_ASSIGNED_PRIMARY;
    DevPer := ROUND(DevTime/PSPTime,2)*8;
    timeleft := TRUNC(((NVL(rqstdeloe,0) - NVL(rqstdaloe,0))/DevPer)+.99999,0);
    rqsttarget := to_date(sysdate,'mm/dd/yyyy') + timeleft;
    RETURN rqsttarget;
    END;

    Hi Dave,
    just a quick hint. If you just want to have the time part of a date/sysdate, you can use TRUNC to do that. So your existing code
    rqsttarget := to_date(sysdate,'mm/dd/yyyy') + timeleft;could be changed to
    rqsttarget := trunc(sysdate) + timeleft;If you perform a TO_DATE on a date variable, the PL/SQL engine will first convert that date variable with an implicit type conversion to a VARCHAR2, because the TO_DATE interface only supports VARCHAR2's and NUMBER's.
    But implicit type conversions are always dangerous, because if your default date format mask isn't mm/dd/yyyy your TO_DATE will fail.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Enter a value using set value dynamic action

    Hi,
    I'm using Oracle 11g XE with apex 4.0.2.
    I've been trying to use a dynamic action on a text field 'item_group'. Button doesn't have this facility. I created an advanced action using 'set value' with no condition the value being 'RAM.' The event is "change", selection type 'event source', set type is 'static assignment' and value is RAM. It is supposed to trigger when the create button is pressed but nothing happens and the field is still null. I've tried variations on this but nothing works. Can anyone help.
    Thanks
    Tim

    are you looking dynamic sql ?
    Refer this
    http://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adg09dyn.htm

  • Dynamic action with set value on date field

    Hi,
    I'm using APEX 4.02
    I'm trying to calculate the age based on the date of birth dynamically on a form. I'm trying to do this with a (advanced)dynamic action with set value.
    I'm able to get this kind of action working based on a number field etc, but NEVER on a date field.
    I've read all posts on this subject but so far no solution. Even if I try to simply copy the value over to another date field or typecast it to a string ( to_char function ) it does not work. So for me the problem seems to be in the source field being a date field.
    I've tried using the source value as is in a select statement :
    select :P33_GEBOORTEDATUM from dual;
    and also type casted based on the date format :
    select TO_DATE(:P33_GEBOORTEDATUM,'DD-MON-YYYY') from dual
    but still no luck.
    On the same form I don't have any issues as long as the calculation is based on number fields, but as soon as I start using dates all goes wrong.
    Any suggestions would be greatly appreciated. If you need any extra info just let me know.
    Cheers
    Bas
    b.t.w My application default date format is DD-MON-YYYY, maybe this has something to do with the issue .... ?
    Edited by: user3338841 on 3-apr-2011 7:33

    Hi,
    Create a dynamic action named "set age" with following values.
    Event: Change
    Selection Type: Item(s)
    Item(s): P1_DATE_OF_BIRTH
    Action: Set value
    Fire on page load: TRUE
    Set Type: PL/SQL Expression
    PL/SQL Expression: ROUND( (SYSDATE - :P1_DATE_OF_BIRTH)/365.24,0)
    Page items to submit: P1_DATE_OF_BIRTH
    Selection Type: Item(s)
    Item(s): P1_AGE
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

  • Dynamic Action on tabular form: to auto set value for all changes rows

    Hi All:
    I am using APEX4.2.3 and I am not very familar with JQUERY or Javascript.
    I am having a tabular form to support Update and Delete action. The tabular form has 4 columns:
    Column A: ID                      (Number)     : Read-only column
    column B: Name                 (Varchar2)   : Editable
    Column C: Age                    (Number)     : Editable
    Column D: ChangeFlag      (Varchar2)   : Read-only column                             ==> however, I want this column been automatically upldated by my APEX application
    Here is the requirement: First user update Column B, or C or both for # of rows; then user click "Save Change" button. For ALL updated rows, I need to automatically update Column D with below logic:
    For a given row,
                   IF Column D IS NULL  THEN
                         set value = 'M'                           -- M means modified
                   ELSE --- column D has a value already
                        IF last character of Column D is 'M', THEN
                               don't do anything;
                        ELSE
                              set value of D = existing value + 'M'                       (here + means concatenate
                       END IF;
                END IF;
    I thought this can be done by creating dynamic action on tabular form ... I have researched this on this forum and can't find a good match example ..
    I know I can implement this using a DB trigger; however, I want to learn if this can be achived via Dynamic Action.
    Thanks!
    Kevin

    Hi Expert:
    Anyone can offer any direction or help on this?
    Thanks!
    Kevin

  • How to add a column to a list created with the Dynamic List Wizard to display the values of the fiel

    Hi,
    ADDT, Vista, WAMP5.0
    We have 2 tables: clients_cli (id_cli, name_cli, tel_cli, and several more fields) and cases_cas (id_cas, idcli_cas, court_cas, and a lot of other fields).
    Clients may have many cases, so table cases_cas have a foreign key named idcli_cas, just to determine which case belongs to which client.
    We designed the lists of the two tables with the Dynamic List Wizard and the corresponding forms with Dynamic Form Wizard.
    These two forms are linked with the Convert Dynamic List and Form Wizards, which added a button to clients list named "add case".
    We add a client and then the system returns to the clients list displaying all clients, we look for the new client just added and then press "add case", which opens the Dynamic Form for cases, enter all case details and everything processes ok.
    However, when we view the cases list it display all the details of the case, including the column and values for the foreign key idcli_cas. As you can image, it is quite difficult for a human to remember the clients ids.
    So, in the cases list we added a another column, named it Name, to display the names of the clients along with cases details. We also created another recordset rsCli, selected the clients_cli table, displaying all columns, set filter id_cli = Form Variable = idcli_cas then press the Test button and everything displays perfect. Press ok.
    Then, we position the cursor inside the corresponding cell of the new Name column, go to Bindings, click on name_cli and then click on insert. The dynamic field is inserted into the table cell as expected, Save the page, and test in browser.
    The browser call the cases list but fails to display the values of the Name column. The Name column is simply empty.
    This issue creates a huge problem that makes our application too difficult to use.
    What are we doing wrong?
    Please help.
    Charles

    1.     Start transaction PM01, Create Infotype, by entering the transaction code.
    You access the Create Infotype screen.
    2.     Choose List Screen.
    3.     In the Infotype no. field, enter the four-digit number of the infotype you want to create.
    When you specify the infotype number, please remember to enter any leading zeros.
    4.     In the Screen Number field, enter the screen number of the list screen you want to enhance.
    5.     Choose Create.
    The Dictionary: Initial screen appears:
    6.     Create the list screen structure.
    7.     Choose Activate.
    8.     Return to the Enhance List Screen in the Enhance Infotypes transaction (PM01).
    9.     Choose Create All.
    The additional fields are displayed on the list screen, however, they contain no data.
    The fields can be filled in the FORM routine FILL-LISTSTRUCT in the generated program ZPnnnn00. The FORM routine is called for each data record in the list.
    Structure ZPLIS is identified when it is generated with a TABLES statement in the program ZPnnnn00.
    The fields can be filled from the Pnnnn structure or by reading text tables.

  • Dynamic Form in Tabular Form i.e SET VALUE

    Hi,
    I have an tabular form ,
    In which two column are there i.e username and department
    Just I wnt to know can dynamic action i.e SET VALUE CAN BE USED IN TABULAR FORM.
    AS I CHANGE THE USERNAME THERE PERSPECTIVE DEPARTMENT SHOULD CHANGE.
    can anyone help.

    Hello Trent,
    I too, am attempting to set the value of an item when another item is changed.
    I need to capture the APP_USER changing the row for each row changed in the tabular form when submitted.
    My table is in a remote database that is not allowed to have APEX loaded directly in the instance (or db link TO the APEX instance).
    Can’t get the APP_USER making the change at this level, as the APEX code is not there.
    The instance that hosts the APEX installation accesses the table via a view through a db link.
    Can’t use a trigger on the view to set the APP_USER using APEX functionality.
    Not desirable to re-invent the IUD wheel using instead-of triggers.
    The example you posted on http://apex.oracle.com/pls/apex/f?p=45448:11 is exactly what I need (even though your example sets the value on Lose Focus and I Set value on Change).
    I am attempting to implement the dynamic action for the item using your javascript, and am almost there....but not quite. The dynamic action is updating the target item in ALL the rows in the tabular form, not just the one that is being changed.
    This, I am sure, is due to my inexperience with Dynamic Actions, jquery syntax, and the javascript API’s for APEX. I believe I know what the issue IS, I’m just not sure how to work around it.
    Please note: I attempted to download your example at the above website (turning off popup blockers), but had no success (I got the thank-you for downloading message, but have no clue what was downloaded to where). I was hoping to compare your form Dynamic action with mine to see where I went wrong.
    If you could please, review the following and:
    1)     let me know what might be different from your working example?
    2)     provide info on how to get your working form downloaded (such a tease to have the download link there and not get it to work ;0} ) , please?
    The following shows the html from view source for a row in my tabular form. This will help you get an idea of the items. The actual number of rows in the form is about 50.
    <table cellpadding="0" border="0" cellspacing="0" summary="" class="report-standard">
    <tr class="highlight-row">
    <td headers="CHECK$01" class="data">
    <label for="f01_0002" class="hideMe508">CHECK$01</label>
    <input type="checkbox" name="f01" value="2" class="row-selector" id="f01_0002" />
    </td>
    <td headers="JOBNO_DISPLAY" class="data">X111Y2222</td>
    <td align="center" headers="DEPR" class="data">
    <label for="f03_0002" class="hideMe508">DEPR</label>
    <input type="checkbox" name="f03_NOSUBMIT" value="1" id="f03_0002_01"
    onClick="if (this.checked) {apex.jQuery('#f03_0002').val('1');}
    else {apex.jQuery('#f03_0002').val('');}" />
    <input type="hidden" name="f03" value="" id="f03_0002" /></span>
    </td>
    <td headers="UPDUSER" class="data">
    <label for="f04_0002" class="hideMe508">UPDUSER</label>
    <input type="text" name="f04" size="16" maxlength="2000"
    value="MOMSDAT" id="f04_0002" />
    </td>
    <td headers="DERIVED$01" class="data">MOMSDAT</td>
    <td headers="UPDDATE" class="data">13-DEC-11
    <label for="f02_0002" class="hideMe508">JOBNO</label>
    <input type="hidden" name="f02" value="X111Y2222" id="f02_0002" />
    <input type="hidden" id="fcs_0002" name="fcs"
    value="DB31F7B9ED99E6A2F7295F6B7D236409">
    <input type="hidden" id="frowid_0002" name="frowid"
    value="AAATI3AAGAAAAIXAAo" />
    <input type="hidden" id="fcud_0002" name="fcud" value="U" />
    </td>
    </tr>.....
    <tr>.....</tr>
    </table>
    To help explain:
    I have a checkbox associated with array name f03_NOSUBMIT,
    This checkbox OnClick updates a hidden item associated with array name f03. The hidden item is linked to the depr column of my view/table (this functionality is straight from Oracle’s tabular checkbox wizard – works great, no problems).
    When the check box is changed, I need to capture the APP_USER value in the UPDUSER field associated with the f04 array (nice that the array names matched up with your example :0} )
    To do so, I created a dynamic action:
    Name: Set_Upduser
    Sequence: 10 (it’s the only DA)
    Event: Change
    Select Type: jQuery Selector
    jQuery Selector: input[name=”f03_NOSUBMIT”]
    --note: the event does not fire if I use f03
    --since that value is not actually
    --changed until submit with this
    --method.
    Condition: - No condition –
    True Actions:
    Sequence: 10
    Action: Set Value
    Fire When Event Result is: True
    Fire On page Load: Unchecked
    Stop Execution On Error: Checked
    Set Type: JavaScript Expression
    JavaScript Expression:
    var row = $x_UpTill(this.triggeringElement, 'TR');
    var otherElement = $('input[name="f04"]',row)[0];
    otherElement.value = '&APP_USER.';
    Selection type: jQuery Selector
    jQuery Selector: input[name="f04"]
    This ALMOST works...
    When I run the page and click on just one check box, the UPDUSER fields are updated with the APP_USER for ALL the records, not just the row for the checkbox I clicked. And, if I submit the changes, ALL the records in the table now have the APP_USER in the UPDUSER column. Not just the column where the check box was changed (Which would be expected since all the values are changed in the form – hey, the submit part works :0} ).
    Your example at http://apex.oracle.com/pls/apex/f?p=45448:11 works, setting the value for the target field only for that row. If I can get mine to work the same way, I will be good to go (as in hog-heaven, doing the Snoopy Supper-Time dance).
    I am thinking my issue is with the row identification in the
    --- var otherElement = $('input[name="f04"]',row)[0];
    I seem to not be picking up the row value in the row var.
    Am I reading line correctly where 'input[name="f04"]' is pNd, and row is pValue? Read the description of the $x_UpTill API, not sure how this is working to identify pValue (Row?).
    Additionally, I am not sure what the [0] is for at the end of the otherElement var definition. I don’t see that listed with the $ JavaScript API parameters (Google wasn't much help there either).
    OR, am I missing something else?
    Once again, if you could:
    1) let me know what might be different from your working example? (What does yours have that mine doesn’t)
    2) Provide any info on how to get your working form downloaded at http://apex.oracle.com/pls/apex/f?p=45448:11. Please, please?
    As always, your assistance is greatly appreciated!
    Edited by: amckinne on Dec 27, 2011 5:29 PM
    Edited by: amckinne on Dec 27, 2011 5:33 PM

Maybe you are looking for

  • Withholding Tax Selection during Sales order creation

    Hi, Do we have an option to select or deselect Withholding Tax Codes at the time of Creating Sales order / Billing for the Customer? As, We get the popup during the time of invoice creation to the vendor. Your inputs are appreciated. Thanks & Best Re

  • Changed to Uverse from DSL, TC won't work

    We recently switched our home business network from AT&T DSL service to Uverse. I can't get the Time Capsule to stop flashing amber. I have tried to configure it through our computers (including while directly wired from the Uverse router) and they s

  • Master data dealetion program

    hello friends, I have to create one program,in which whatever data range will enter by user in selection screen those master data will be delete from the master table. Can you please tell me the logic behind that.... Thanks in advance

  • Wrapping All Content

    Hi there, I'm wanting to wrap all my content (DIVs) with one big DIV so that I can change the background of the page and keep the thing integral. The DIV I've used to wrap the content (.outer) does't seem to wrap all of the content on the page. Is an

  • Duration for transition wont change from 00:00:00;22

    I am trying to add a Dissolve transition between 2 clips in the timeline but the duration won't change from 00:00:00;22. I set the time in the transition editor and and drag it to the timeline but it still changes to 22 frames. I have tried dragging