How do I use qRules to calculate field values based on other form fields? - InfoPath Dev
in

InfoPath Dev

How do I use qRules to calculate field values based on other form fields?

Last post 06-14-2012 01:02 PM by ErnestoM. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-14-2012 10:06 AM

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

    How do I use qRules to calculate field values based on other form fields?

    I'm somewhat new to InfoPath and completely new to qRules. I have a form with several fields that need to be calculated based on the values of other form fields. I am going through the qRules v4.1 User Guide Change Log to see what rules are available. It is difficult to find the rule or rules I need to use.

    For background; currently the form is a SharePoint list form rendered in the browser. In the next iteration of my application the form will remain a browser rendered form but work with database tables and SharePoint lists using DBXL. Right now I have SharePoint 2010 calculating the values. The users want to see the calculations appear on the forms as they are filling it out instead of having to wait for the form submission to the SharePoint list.

    The calculations being performed in SharePoint are:

    /* dollarDiscount */ =parAmount*allInRate*(DATEDIF(settlementDate,maturityDate,"d")/discountDays)

    /* price */ =1-(dollarDiscount/parAmount)

    /*totalProceeds */ =parAmount-dollarDiscount

    The last two calculations rely on the first calculation. All variables are form fields.

    How do I best use qRules to accomplish the above?

    Filed under: ,
  • 06-14-2012 11:05 AM In reply to

    Re: How do I use qRules to calculate field values based on other form fields?

    Hi-

    qRules has a command called DateDiff (used as an example in the User Guide and the Quick Start). This command would take the place of DATEDIF.

    The syntax of the DateDiff command in qRules is similar to that in SharePoint. You'll find full details in the user guide, but let us know if something isn't clear.

    The rest of the calculations can be handled via regular InfoPath rules, no qRules required.

    Hope this helps!

     

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 06-14-2012 12:13 PM In reply to

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

    Re: How do I use qRules to calculate field values based on other form fields?

    Hi Ernesto,

    I have read the DateDiff example in the User Guide. It is a standalone example, it does not show how to use the command in line with a calculation.

    I am trying to build a rule that executes when the field 'All In Rate' changes that calculates and populates the 'Dollar Discount' field. See attached screen capture.

    The DateDiff example is only returning data in a debug field, not to a specified field. Is there a tutorial, webcast, or other documentation that explains how to use qRules in formulas?


  • 06-14-2012 01:02 PM In reply to

    Re: How do I use qRules to calculate field values based on other form fields?

    Hi-

    I see, sorry for the confusion.

    qRules can't be used within a formula. You'll have to set the Command node to your DateDiff (using the correct command syntax). Executing this command will populate the QdabraRules > Result node. Then you could have a separate rule that stores that result somewhere. Perhaps you'll store the result in a node in your schema and that node is not displayed in the canvas. Once you have the node in your schema, with the value of Result store in it, then you can use that value as desired in other calculations. Does that make sense?

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


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