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

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

Recommended Posts

Posted

I have a script that pauses for the user to modify 3 fields in a record.

Is it possible to have the script continue without pressing Enter or clicking on a Continue button once the 3rd field is modified? Or is it possible to script the pressing of the Continue button? I can trigger the selection of a button upon modifying the 3rd field but that doesn't "press" it.

I guess what I'm asking in general terms is if there is a way for a script to be paused until certain conditions are met and then resume without the user having to click anywhere or press the Enter key.

Cheers,

Alvise

Posted

How will the script know when the conditions are met if it's paused? It will need to periodically resume itself and check.

Try putting the script into a loop with a pause.

...

Loop

Pause

Exit loop if [ condition met]

End Loop

...

Be aware that such a script an form an infinite loop. Test on a backup copy.

Otherwise, avoid the loop and just run a timed script that checks the 3 fields and completes the process if the conditions are met.

Posted

I had tried that. It doesn't seem to work.

If you could trigger the pushing of a continue button on modifying the last field that would work. Is that possible?

If I split the script into two scripts I don't need the pause but it's not a practical solution.

Thanks for your help.

Posted

You have FM11; therefore onObjectSave script triggers. Nothing stoping you.

Posted

Hi Vaughn,

I had a feeling your Loop suggestion was a good one and that I just didn't have enough experience to get it to work so I kept at it and found a solution:

I have the script go to the first field that needs editing and create a loop which pauses every second if the last of the 3 fields are empty:

Loop

Exit Loop If[3rdField ≠ ""]

If[3rdField = ""]

Pause/Resume Script [Duration (seconds): 1]

End If

End Loop

I have script triggers on the 1st and 2nd fields which are selections from a pull down menu so no need for tabbing between fields. As soon as a value is entered into the last field (or 1 second after) the script resumes, coming out of pause. With this solution I'm avoiding the tabbing between fields and the pushing of the Continue script button. But more importantly for me, whoever is editing the record won't be going through all the fields and perhaps editing other fields with the script is still paused, since it includes further instructions as to what should be done next.

I am not a full time FM developer, having developed a solution (albeit rather extensive and complex) for my buisness so I've basically taught myself since v3 (besides all the great help I've had from this forum) so I may miss things that are just plain obvious for those of you who do this every day.

Thanks again for your help, this is a great forum!

Cheers,

Alvise

Posted

Do not use field = ""

Use IsEmpty( field ).

I don't like the loop with the 1 second pause, it was not what I suggested.

You need to explain WHY you need something like this.

Posted

Thanks Vaughn. I have made the change you suggested.

The script is used in an accounting module when transfering funds from one of our bank accounts to another of our accounts. I use multiple bank accounts for different projects either to conform to specific Brazilian legislation which governs the tax deductible sponsorship of cultural events (which is the area my firm specializes in) or for certain accounts that are used for financing, investments, etc.

So when I have a transaction that transfers funds from one of our accounts to another, that same transaction is entered once as an expenditure and once as an income for each respective account. I've created the script so that the transaction entered as an expenditure is imported to the income table, leaving 3 blank fields which need to be entered according to which account is recieving the funds. The choices of these 3 fields are made from drop down menus with script triggers set to move you to the next field once the selection is made. This streamlines the entering of data eliminating tabbing or mouse clicking between the fields. Once data is entered in the 3 fields a custom message allows you to choose to continue editing the record or to save the record and close the window, returning to the original window the script was run from to continue your work. I find it silly to have to press the continue button to resume the script. Also, unless there is a way of doing this I'm not aware of, once the script is paused you can continue to go on and do other things, further editing the record, close the window, exiting the script, etc., in which case you may be able to exit out of the script without recieving the final instructions or finishing the editing and saving the record properly.

The 1 second loop seems to work very well as it doesn't let you move on until data is entered in the 3 fields.

If there's an safer, more efficient way of doing this I'd love to know!

Posted

I'd like to know as well, but would like to point out that your script could be dangerous since if a second goes by and all three fields have something in them, but incomplete information, clicking outside of the field will cause the script to continue with incomplete information.

I think this is a simple question, but why does it say "Pause/Resume" if it only pauses, and doesn't resume?

Posted

Because it can resume the script after a defined period of time.

Pause/Resume [ 30 seconds ]

Debating the name of the command isn't very useful. Understanding what it does and how to use it will be more productive.

I still want to hear WHY something like this is needed.

Posted

The fields are drop down menus (value lists) whose content is validated to reduce the chances of error and cannot be incomplete or empty as this will result in a failed validation, so there can't really be any incomplete information there in this particular case. Clicking outside the field will bring up the save message, which will fail if you click save. But I agree it could be dangerous in other circumstances.

Posted

Why don't you simply split the script into two, and trigger the second script upon modification of the last field?

BTW, I don't see why users couldn't fill out all transaction details (including which account to debit and which to credit) beforehand. Not to mention that if you really need two records for one transaction (??), then the other record could be created via relationship.

Posted

Splitting the script into 2:

I tried Splitting the script into 2 as you describe and that works, but there can be instances where the 2nd part does not trigger or conclude and the final instructions wouldn't be passed to the user. The way I have it now works very well. I see no problems with it. WHY shouldn't I do it this way?

Why 2 records for 1 transaction?:)

As for two records for one transaction, it is really two transactions. All records correspond to transactions in bank statements. So I have a record which corresponds to an outgoing sum in one account statement, and one record which corresponds to an incoming sum in another account statement.

I guess I could create the incoming record via relationship but I only need to identify which account to credit when I'm transfering funds from one of our accounts to another of our accounts, and not for all payments.

In any case I thank you for this suggestion. I will look into doing it this way. I could set the values of 2 of the 3 fields to be modified automatically based on fields in the outgoing record, eliminating the need for both the script as well as manually entering data in the 2 remaining fields. In this case I would add a credit account field in the outgoing table (which is one of the 3 fields to be filled in in the incoming table), which would be the match field for the relationship, correct?

Posted

there can be instances where the 2nd part does not trigger

Why would that happen?

WHY shouldn't I do it this way?

For two reasons:

1. The cursor and the status toolbar are flashing;

2. It is not good user interface (and this applies to both methods):) suppose the user has mistakenly selected a wrong value: she sees this, but before she can do anything about it the script exits the loop (or triggers) and whisks her away.

... I would add a credit account field in the outgoing table (which is one of the 3 fields to be filled in in the incoming table), which would be the match field for the relationship, correct?

I'm afraid I got lost there...

Posted

Thanks to all for your input!

I have modified the script so that the record in the credits table is created based on a relationship.

All I needed to do was create a field called "Account Credited" in the debits table which is only available on a layout called by a script button to "export record to credits". Once the account is selected by value list and passes validation to avoid selecting an ineligible account, a new entry is created in the credits table and all necessary fields are set via the relationship. As I was wrapping my brain around this problem I realized that both of the remaining 2 fields that required entry in the credits table could only have one "correct" possible choice from their associated value lists based on the data in specific fields in the debits record (one of these require data that is not necessarily the same as the data in the corresponding field in the debits table and the other field does not exist in the debits table and therefore requires entry). So these 2 fields are now set by calculations, which means no user error.

HOWEVER, I still need to use the Pause/Resume script step when the script is called and waits for the user to enter the Account Credited field. I have a continue button there so the user can make sure she has selected the proper account. I was trying to avoid this in order to streamline the process earlier but in this case the layout contains only the Account Credited field as a Pop-up menu and the continue button. It is a much more streamlined solution requiring only a verification of the newly created record in the credits table and most likely no modification. So I guess I can live with it.

(OK - so I have a cake. I love this cake. I love eating this cake. But I love this cake. It's really good cake...Hey! were's my cake!...)

Posted

I don't know of a way to resume a paused script other than:

(a) user clicks the "Continue" button in the status toolbar; or

(:) user clicks a button set to Resume Script; or

© user clicks a button set to run another script, with the option to Resume current script.

That's why I suggested splitting the script into two.

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