Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Calculation based on user selection


This topic is 4592 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi

I am not sure if this forum is the best to post this query.

I have what I think is a very basic question.

I have a dialog box with a pop up menu.

The user selects a value

I then have a calculation which goes something like: " If choice 1 or choice 2 or choice 3 then do this OR if choice 4 or choice 5 then do another.

I have done this in the context of a case function.

This seems inelegant. Is there a neater way to determine which calculation to perform based on the user choice without all the "or's"

Joseph

Posted

Can you explain further what you are trying to do with the true context ( not concerning technique or hypothetical scenarios )

Posted

Yes

The user selects a value from a popup menu. Depending on the choice a script will run. Thus if they select value "a" or "b" or "c" then each of these will trigger the SAME script but if they select "d" or "e" or "f" then a different script will run.

My question is how can avoid the "if a or b or c " and instead somehow lump the a, b, c together and the d,e,f together?

Joseph

Posted

Try something like =

not IsEmpty ( FilterValues ( "a¶b¶c" ; YourTable::SelectedValue ) )




Note that this is a purely cosmetic adjustment; functionally, it's the same as =




YourTable::SelectedValue = "a" or YourTable::SelectedValue = "b" or YourTable::SelectedValue = "c" 

Posted

So is anything gained by this approach?

I guess my question is based on creating more efficient code which in turns translates into faster execution

Posted

So is anything gained by this approach?

I guess my question is based on creating more efficient code which in turns translates into faster execution

Be careful of "premature optimisation".

It might a fine achievement shaving a couple of minutes off a 7 minute process, however if the process is only run once a week there is little benefit to the client. On the other hand, saving a second from a process that is performed several times an hour will have a huge impact.

IMHO get the whole solution working and into production, THEN look at where optimisations can be made that will provide a return on the investment.

This topic is 4592 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.