The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Automatically Updating Text Object
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Asmetana1

USA
9 Posts

Posted - 05/15/2020 :  1:39:44 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
OriginPro 2020 (64-bit) SR1 9.7.0.188
Operating System: Windows 10
I have a graph which plots data from an SQL database. The graph has a text object which includes a session variable that provides information about the data the user selected. The variable is set by a script which should run whenever the user selects a new set of data from the SQL database. If I run the script in the script window and then examine the text object properties, the preview shows the correct information. I added the script in the programming tab of the text object, but it never runs. I suspect this is because I haven't selected the correct combination of options (Attach to, Event, etc) on the programming tab.
1) Is the text object the correct place for the script?
2) If it is, what combination of options do I need to choose so the script will run whenever the user pulls new data from SQL?
Thanks,
Andy

cpyang

USA
1406 Posts

Posted - 05/15/2020 :  5:02:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Script in text object is not reliable. Origin has the general Recalculate framework and that is what you should use.

Add a column to the worksheet with the SQL connection, and use Before Formula script in that column to run your code.

Usually the column calculation will result in values that you want to show in a graph, and the triggering is done by setting the input of that column formula. If the calculation can be expressed by a formula, then the input is automatically analyzed by Origin, but you can explicitly add input in the Before Formula script like

double aa=col(A)[1];
so even though you don't use that in your code, Origin will still recognized col(A) is an input so when new data is imported, the formula will be triggered.

CP

Go to Top of Page

Asmetana1

USA
9 Posts

Posted - 05/19/2020 :  09:07:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the pointer. I was able to use "Set Column Values" to create the value for the text label. I was also able use the script tab in worksheet properties.
I appreciate the help.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000