Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi,

I was wondering what could be the difference from these 2 Case Statement structures. Is one more efficient that the other ? Why ?

Case(Value = "A", "Result 1", Value = "B", "Result 2", Value = "C", "Result 3")

Case(Value = "A", "Result 1", Case(Value = "B", "Result 2", "Result 3"))

Just curious about it

The difference is if the Value="D".

In the first example, you get nothing; in the second, you get "Result 3".

Flippant of me, I know.

  • Author

Thanks Dan, I knew I was missing something obvious.

I thought the empty result would have come with :

Case(Value = "A", "Result 1", Value = "B", "Result 2", Value = "C", "Result 3", " "), that is the last " "....

Thanx again. smirk.gif

as for timing - the nested case seems to be a little bit slower ...

don't know why.

just see attached test file (& correct the calc, that did escape me, dan ..)

caseTest.zip

had to delete sample records because of upload limit - have a look at the script to create new ones ...

  • Author

Hi Christian,

Thank you to reply in depth to my question.

Yes, apart from my errors about the empties, I had tested both methods while creating the calcs for the "Minimum Quantity in Stock" (you surely remember this thread), and I also had the feeling that a nested could be slower from a classic case.

Now, I don't have any idea of what I should see on your sample. My apologizes ; crazy.gif

>Now, I don't have any idea of what I should see on your sample. My apologizes

Instructions:

Open case-test.fp5

run script "make records" - this will create 20,000 records

the run script "run tests-start"

or just have a look at the results - a negative av(erage) means that case statement # 1 is faster than nested case statement #2.

The file replaces the field "test" using both case statements, recording script start time & end time before each run. In case results the time needed to run the replacement are recorded...

It seems the nested case would be slower as the resulting abstract syntax tree would be wider/deeper to traverse.

  • Author

Well, in my mind, the nested would have eliminated first cases and concentrates the calcs only on the residual "true" results. This seems to me a quicker process.

Not sure I make me clear, but I still think it's strange.

BTW Christian....great test !

That is a good point. What I mean, is that the resulting data structure for any nested conditional is larger than for single conditionals. More branches to look at and evaluate.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.