cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Write a formula using selected rows of a grid

AN_9685270
5-Regular Member

Write a formula using selected rows of a grid

Hello,

I Want to write a formula or an expression using selected rows of a grid, if you have any idea how to do it i would be grateful.

I will attach what I want to do in the mashup

 

Thanks in advance 

7 REPLIES 7
slangley
23-Emerald II
(To:AN_9685270)

Hi @AN_9685270.

 

We're not clear on your needs.  Please provide more detail around the use case.  What specifically are you trying to do?

 

Regards.

 

--Sharon

AN_9685270
5-Regular Member
(To:slangley)

thank you @slangley for your reply,

 

what i want is to write an expression or a forumula( like in excel ). 

So my idea is, i want to write the id of (selected  row from the grid) in a text field and do  some calculations.

 

For example: 

if i have in my grid :

Id :A ,thing1,( with some properties: like  propValue

Id: B ,thing2,

Id: C, thing3

and I want to make a forumula between those things 

formula  = A +C/B

(so the meaning behing is

formula = Things["thing1"].propValue +Things["thing3"].propValue /Things["thing2"].propValue 

then this formula is applied on a propValue of our new (thing which is equivalent to an energy meter)

I Wish i was clear and thank you in advance

Ashritha
13-Aquamarine
(To:AN_9685270)

Hi @AN_9685270 ,

 

If you have predefined list of formulas and just want to take input from a grid; Then you can follow below procedure.

  • Create a custom service to use/write formulae based on your input.
  • Mashup : 
    • Allow selection in grid
    • The required input for the custom service can be bound from the selected rows of the service from which grid data is populated.
    • To trigger the custom service , you can make use of SelectedRowChanged event of the service that populates the grid data.

Hope it Helps!!!

jeafrati
5-Regular Member
(To:AN_9685270)

I didn't fully understand your use case, but I did come up with something that might help get you started. I have a text box where they type out the formula. They can select a row in the grid and add that row's formulaID value to the formula text box. The calculate button will take the formula and parse it for those formulaIDs and replace them with the value related to the formulaID and then it will eval the formula string and return that value. There were many assumptions that were made, so I would recommend to use this as a starting point for your use case. The entities file is attached to this post.

slangley
23-Emerald II
(To:slangley)

Hi @AN_9685270.

 

We still don't have an understanding of your use case.  If you can walk through a couple of user scenarios of what is being clicked and what should happen, we might be able to recommend a solution.

 

Regards.

 

--Sharon

slangley
23-Emerald II
(To:slangley)

Hi @AN_9685270.

 

If the previous response answered your question, please mark it as the Accepted Solution for the benefit of others in the community.  If you still have questions, please let us know.

 

Regards.

 

--Sharon

slangley
23-Emerald II
(To:slangley)

Hi @AN_9685270.

 

Please advise if one of the previous responses answered your question by marking the appropriate one as the Accepted Solution.  If you're still having issues, please provide more details around your use case.

 

Regards.

 

--Sharon

Top Tags