Jump to content

Individual Pieces of Calc work until Combined in Script for Script Trigger


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

Recommended Posts

Purpose:  To capture the contents of a field before it is changed.  Compare the before to the after.  Highlight the after and screen capture then export.

 

I can't get past the first sentence and it's getting frustrating because it seems extremely simple.

 

1 Field:  OnDeck_t (text)  -  The OnDeck_t field data = On

2 Field:  OnDeck_before (Where I want to capture the OnDeck_t before it's changed)

 

I have an OnObjectEnter script trigger on the OnDeck_t field that runs this script:

Set Field By Name [substitute (Get (ActiveFieldName); "_t"; "_Before"); Get (ActiveFieldContents)]

 

If I do this it works fine.  (But I don't want it hard coded.  I will be using it for all the fields on the layout):

Set Field [OnDeck_before; Get (ActiveFieldContents)]

 

 

I have divided the Substitute (Get (ActiveFieldName); "_t"; "_Before") and Get (ActiveFieldContents) into separate lines in Data Viewer and both return expected results.  Why doesn't it work when it's part of a 'Set Field by Name' script step?

 

Thanks.

Link to comment
Share on other sites

OK I created a script called "Before".

 

It has one step:

Set Variable [$before; Value: Get(ActiveFieldContents)]

 

There is an OnObjectEnter script trigger on the OnDeck_t field (On; Off Radio buttons) with the "Before" script set.

 

From what I understand, the "Before" script should run after I click into the OnDeck_t field, making it active.  The script should set the $before variable to 'On' which is it's current contents.

 

It doesn't work.  The variable is blank.

 

Any ideas?

Link to comment
Share on other sites

$vars (local variables) only exist for the duration of the script and are lost once the script terminates - hence yours is blank

 

You need to use a $$var (global variable) - these remain in place until the file is closed.

Link to comment
Share on other sites

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