Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jheasley
Luminary Alumni
Luminary Alumni

Variables within Variables

Good Morning All!

I have a use case for embedding variables within another variable to determine limits on gauges. 

take the following variables:

vInvLmtClientA:

If(([Bnfi Nn Client])= 'ClientA', 600,

  0

vInvLmtClientB:

If(([Bnfi Nn Client])= 'ClientB', 15000,

  0

vInvLmtClientC:

If(([Bnfi Nn Client])= 'ClientC', 10000,   

  0

The above variables define the max allowable open transactions for a given client.

I would like a variable that evaluates the selection in [Bnfi nn Client] and gives the SUM of the defined limit for the selection, and if no selection has been made, the limit should be assuming that ALL clients are selected. 

Thank you ALL!!

1 Solution

Accepted Solutions
marcus_sommer

My suggestion is only a short version and it could be extended for it, for example:

pick(wildmatch(getfieldselections([Bnfi Nn Client]),

     'ClientA', 'ClientB', 'ClientC', 'ClientA, ClientB', 'ClientA, ClientC', 'ClientB, ClientC', '*'),

     600,15000,10000,15600,10600,25000,25600)

whereby it made it obvious that this logic is quite expensive and if there are more selection-possibilties it would be more suitable to create an own field for these factors and then just using: sum(factor) for it.

- Marcus

View solution in original post

4 Replies
marcus_sommer

Maybe you could use something like this:

pick(wildmatch(getfieldselections([Bnfi Nn Client]), 'ClientA', 'ClientB', 'ClientC', '*'), 600,15000,10000,25600)

and only if there is a multiple usage of this expression it made sense to use a variable for it.

- Marcus

jheasley
Luminary Alumni
Luminary Alumni
Author

so i tried this, and i'm not getting the expected result.  when i select ClientA and ClientB, the upper limit sets to 25600, instead of 15600. not sure if i entered the expression incorrectly or if i didnt properly explain what i was trying to do.  It may be that what i want is not possible.

marcus_sommer

My suggestion is only a short version and it could be extended for it, for example:

pick(wildmatch(getfieldselections([Bnfi Nn Client]),

     'ClientA', 'ClientB', 'ClientC', 'ClientA, ClientB', 'ClientA, ClientC', 'ClientB, ClientC', '*'),

     600,15000,10000,15600,10600,25000,25600)

whereby it made it obvious that this logic is quite expensive and if there are more selection-possibilties it would be more suitable to create an own field for these factors and then just using: sum(factor) for it.

- Marcus

jheasley
Luminary Alumni
Luminary Alumni
Author

Thanks - the 3 client use case is just for testing and prep, there are actually 34 clients, so while your solution very helpful and would work on a small scale, it isnt practical on a larger set.  thanks for your help!!