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

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

Recommended Posts

Posted

Hi Folks!

I am trying to learn how to use the custom message script step where before a calc is executed a pop up window appears to allow the user to choose to abort the script or continue by selecting "OK" or "Cancel" buttons that are the default setup:

Show Custom Dialog ["", "Are you sure you wish to continue?"]

Insert Calculated Result [select, "bid 2, "Case(isEmpty(bid) =1, 0, bid * 1.1)"]

But the calculated result of bid * 1.1 is always displayed regardless of the button selection in the custom dialog that comes up.

Where have I gone wrong, if you please?

Thanks in advance

Posted

(isEmpty(bid) =1

Illogical request. I believe the test sees the IsEmpty() and skips the = 1. You would need either Case(IsEmpty(Bid) ... or Case(Bid = 1

But that's not all ... after your Show Custom Dialog, you need to test for which key the user selected and you need two buttons with YES or NO. Roughly it will look like this:

Show Custom Dialog [ "Yes" ; "No" ; "Do you wish to continue? ]

If [ Get( LastMessageChoice) = 2 ... user selected NO

... halt script or whatever

End If

... whatever you wish to do if user selects YES goes here.

I'm unclear on what the Insert Calculated Result[] is supposed to do. You would probably be better off using Set Field [] here. Insert Calculated Result[] requires that the field be on the layout, whereas Set Field[] does not.

LaRetta :wink2:

Posted

OK ...

The actual calc I provided works fine but also I changed the calc to Case(IsEmpty(bid) = 0, bid *1.1) which works.

Can you explain how to configure the message to either allow the script or stop it so that no change is made to bid in FM 6 -- I tried your solution and there is no "Get(LastMessageChoice)" in FM 6 as far as I can see...?

Thanks LaRetta:)

Posted (edited)

IsEmpty and = are different tests. IsEmpty is one test ... then checking if Bid is equal to 0 is another test. It may work ... but not because it is right. Anyway, I assume bid is a number field? You didn't indicate it was for vs. 6 but it's an easy change:

Show Message [ "Yes" ; "No" ; "Do you wish to continue? ]

If [status (CurrentMessageChoice) = 2 ]

Halt Script

End If

Set Field [ Bid2 ; Case ( Bid , Bid * 1.1 ) ]

If you only want to set Bid2 if Bid contains a value, then that should be handled before the Set field []. Otherwise, when User says 'yes' and nothing happens (when Bid is empty or 0), they will think your script is broken.

The reason I didn't perform a test in that Case() is because it isn't necessary. It will only evaluate if bid contains a numeric value (and thus produces a boolean true). With number fields, it really doesn't matter if the field is empty or a 0 - it evaluates the same (false) in either case. If you would like to stop the process if bid is empty or has 0 value, we can do that instead. The choice is yours ...

to either allow the script or stop it so that no change is made to bid in FM 6

Bid won't be changed either way! Only Bid2, unless I'm misunderstanding what you want to do. If so, give us more info and we'll help you through it. :wink2:

LaRetta

Edited by Guest
Changed Bid fields
Posted

Case ( isEmpty (bid) = 1 ; 0 ; bid * 1.1 )

is the same as:

Case ( isEmpty (bid) ; 0 ; bid * 1.1 )

or:

Case ( not isEmpty (bid) ; bid * 1.1 ; 0 )

or simply:

bid * 1.1

This topic is 6850 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.