Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
BSCIknowlec
Contributor III
Contributor III

set analysis based off user input

Hi All,

im looking for some advice, i have a text object that will display standard deviation. however i need the calculation to change based on the user input. 

there are 4 fields named "distal" "prox", "distal 2" and "prox 2" in my table. each of these fields have values in them. I need my calculation to know that when the user selects the "prox" button, that it will only display the STD for the values in that  prox field? 

 

here is my calculation so far, 

"=3*(Stdev(Aggr(Sum(distal),BatchSeq,CATHETER)))"

 

as you can tell, the above calculation will work for the field "distal" but it wont for the others, is there anyway i can replace the distal with a correct function that will display the correct field once the user selects which one they want to view?

 

thank you ,

Ciarán

Labels (3)
5 Replies
marcus_sommer

You could replace the hard-coded field with a variable-value (controlled by one/several buttons or an inputbox) or with a selection (from an island-table) and this may the look like:

3*(Stdev(Aggr(Sum([$(var)]),BatchSeq,CATHETER)))

or 

3*(Stdev(Aggr(Sum([$(=minstring(SelectionField))]),BatchSeq,CATHETER)))

- Marcus

BSCIknowlec
Contributor III
Contributor III
Author

Hi Marcus,

what would the variable look like for these 4 fields? i currently just have a variable named vSection and have a set variable for each button with prox = 1, distal = 2 etc and that works for my filtering, i tried inputting that variable in the calculation but had no luck. 

edwin
Master II
Master II

are you saying for the expression

"=3*(Stdev(Aggr(Sum(distal),BatchSeq,CATHETER)))"

you want distal to be replaced by prox if that is what the user selects?   create a variable driven by the user input.  such that it is the field you want

"=3*(Stdev(Aggr(Sum($(variableFoField)),BatchSeq,CATHETER)))"

this will be evaluated first and substituted with the value either prox or distal before the expression is evaluated

BSCIknowlec
Contributor III
Contributor III
Author

Hi Edwin, thanks for the information,

yes that is exactly what i am trying to do, there will be 4 buttons on the screen and once the user selects lets say "prox" it will automatically update the STD to calculate it just for the values within the field "prox" 

would you know how to go about this? i am a bit of a novice when it comes to these variables, 

marcus_sommer

Each button needs to overwrite the value of the variable (it's only a single one for this use-case) with the value respectively fieldname which should be come in use for your calculation.

IMO easier and with more usability and better usage of the screen is the above already mentioned selection-approach. Just creating an island-table and using the field in a listbox. In your case maybe with smething as this:

t: load pick(recno(), 'distal', 'prox', 'distal 2', 'prox 2') as f autogenerate 4;

and then

3*(Stdev(Aggr(Sum([$(=minstring(f))]),BatchSeq,CATHETER)))

- Marcus