Use a lookup field's value, NOT its ID, in a math formula. - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Use a lookup field's value, NOT its ID, in a math formula.

Last post 02-03-2017 02:09 PM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-03-2017 07:48 AM

    • Matt Leon
    • Not Ranked
      Male
    • Joined on 02-02-2017
    • Head in the Clouds
    • Posts 3

    Use a lookup field's value, NOT its ID, in a math formula.

    I have a text control called "Total Cost". It's action rule has the condition: None - Run when field changes. It's action is: Set a field's value: "$/SQF" = "Total Cost" / "SQF". "$/SQF" is a text field. "SQF" is a lookup field. My issue is that instead of being divided by the value of "SQF", "Total Cost" is instead being divided by the ID of "SQF". Furthermore, I have another lookup field called "Campus". It's action rule has the condition: None - Run when field changes. It's action is: Set a field's value: "SQF" = "Campus". This rule works, because it uses their matching IDs; both "Campus" and "SQF" are on the same list. Is there a way to make it so that "Total Cost" is divided by the actual value of the square footage, not the ID, AND for "Campus" to set "SQF" equal to itself using their shared ID? Thank you,
    Filed under: , , , , , , , , , , ,
  • 02-03-2017 07:55 AM In reply to

    Re: Use a lookup field's value, NOT its ID, in a math formula.

     Yes, you have to use the ID to get the value back from the secondary data source w/ the value. If you can attach your form under the Options tab in a reply, I'd be happy to give you a hand. This tutorial may also help you: https://www.premierpointsolutions.com/training/help-and-how-to-articles/get-infopath-to-display-lookup-column-value-not-id/

    Hilary Stoupa

  • 02-03-2017 08:08 AM In reply to

    • Matt Leon
    • Not Ranked
      Male
    • Joined on 02-02-2017
    • Head in the Clouds
    • Posts 3

    Re: Use a lookup field's value, NOT its ID, in a math formula.

    I did try to follow the steps from that link yesterday, but for some reason the math would return "NaN", "Infinity", "", or the "Total Cost"/ ID. After my failed attempts, I just figured that the link was only showing how to get the field to display the lookup value instead of displaying the lookup ID.
  • 02-03-2017 08:24 AM In reply to

    Re: Use a lookup field's value, NOT its ID, in a math formula.

    Give this one a try. You may want to add a condition to the rule to not run if SQF in the main data source is blank. :) EDITED TO ADD: save the file locally, right click & select design to open in design mode.
    Hilary Stoupa

  • 02-03-2017 10:49 AM In reply to

    • Matt Leon
    • Not Ranked
      Male
    • Joined on 02-02-2017
    • Head in the Clouds
    • Posts 3

    Re: Use a lookup field's value, NOT its ID, in a math formula.

    That worked perfectly. So, is the expression "../d:ID = current()/../my:SQF" a go to for this kind of issue? If so, and someone else needs to do the same thing, I have attached quick how to for where this expression goes.
  • 02-03-2017 02:09 PM In reply to

    Re: Use a lookup field's value, NOT its ID, in a math formula.

    Well, the actual filter (stuff inside the square brackets) will vary, but generally, yes. I used current() instead of the full path to the main data source even though the SharePointListItem_RW node wasn't repeating, just because I wanted the sample to be relevant for you if you had been working w/ repeating data. :)
    Hilary Stoupa

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