Using qRules 4.2 DateDiff with /resultxpath Switch - InfoPath Dev
in

InfoPath Dev

Using qRules 4.2 DateDiff with /resultxpath Switch

Last post 10-08-2012 06:39 AM by DC Forms. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 10-05-2012 11:06 AM

    • DC Forms
    • Top 150 Contributor
      Male
    • Joined on 06-14-2012
    • Washington, DC
    • Posts 76

    Using qRules 4.2 DateDiff with /resultxpath Switch

    First, there are at least two typos in the qRules v4.2 User Guide 2012-09-05.pdf documentation. On page 9 of 87, the DateDiff example for concat is missing a comma after the first element and the quotes in the document are smart quotes so they don't copy-and-paste well into InfoPath. http://www.howtogeek.com/wiki/Disable_Smart_Quotes_in_Word_2007

    Second, I am not able to get DateDiff to work with the /resultxpath switch. My target field for the results is in my Main data source.

    Attempt: concat("DateDiff /date1=", settlementDate, " /date2=", ., " /component=days /resultxpath=", calcSettlementDateMinusMaturityDate)
    Result: Calculation result is sent to the qRules Result node and not the target field, no errors

    Attempt: concat("DateDiff /date1=", settlementDate, " /date2=", ., " /component=days /resultxpath=/my:debtNote/my:helperFields/my:calcSettlementDateMinusMaturityDate")
    Result: Calculation result is sent to the qRules Result node and not the target field, no errors

    Am I missing something with the syntax?

  • 10-05-2012 11:41 AM In reply to

    Re: Using qRules 4.2 DateDiff with /resultxpath Switch

    Hi - thanks for letting us know about the typos.

    To use the resultxpath, you use the second syntax - with the full XPath to the result node. I've attached a sample that shows this working. Did you use the Copy XPath function in InfoPath to get the XPath to your field?

     

    Hilary Stoupa

  • 10-05-2012 12:51 PM In reply to

    Re: Using qRules 4.2 DateDiff with /resultxpath Switch

    not to hi-jack but my question is very similar

     I'm using DateAdd with a /reslutxpath.  it works fine in the preview (filer?).  then I set the form to full trust, saved, admin published.  The form comes up fine in a web browser, but I don't see anything in my field that is suppose to get the result.

    My command :  concat("DateAdd /xpath=/my:myFields/my:ProjectStartDate /months=", ., " /resultxpath=/my:myFields/my:ProjectEndDate")

  • 10-05-2012 12:56 PM In reply to

    Re: Using qRules 4.2 DateDiff with /resultxpath Switch

    Do you have postback set to always on the field or button that executes the command?

    Hilary Stoupa

  • 10-05-2012 01:05 PM In reply to

    Re: Using qRules 4.2 DateDiff with /resultxpath Switch

    that was it, works fine in the browser now. thanks!
  • 10-05-2012 01:08 PM In reply to

    • DC Forms
    • Top 150 Contributor
      Male
    • Joined on 06-14-2012
    • Washington, DC
    • Posts 76

    Re: Using qRules 4.2 DateDiff with /resultxpath Switch

    Hilary,

    Yes, I used the CopyXPath command in InfoPath to identify /my:debtNote/my:helperFields/my:calcSettlementDateMinusMaturityDate as the target node.

  • 10-05-2012 02:05 PM In reply to

    Re: Using qRules 4.2 DateDiff with /resultxpath Switch

    How odd that it works in my sample form and not in your form. Can you email me your form? I can take a quick look.

    Hilary Stoupa

  • 10-08-2012 06:39 AM In reply to

    • DC Forms
    • Top 150 Contributor
      Male
    • Joined on 06-14-2012
    • Washington, DC
    • Posts 76

    Re: Using qRules 4.2 DateDiff with /resultxpath Switch

    I had set the form up with two rules; calculate then set my field to the result node value. I went in to add the above code before sending the form to you so you can see the error, and now the code is working.

    I copy-and-pasted the code from InfoPath into the post, then copied the code from the post back to InfoPath to avoid any typos. Something else must have been wrong/quirky.

Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.