EE - Forum Styles

Operate Script to dynamically change datalink

Does anyone know if it is possible to dynamically change a datalink's source? What I basically want to do is to use data entry expert to allow someone to enter in a parameter name (i.e. module/param1.f_cv) and have that saved off in a variable local to that graphic. Then write a script in the background to replace a datalink's source with the string that was entered (module/param1.f_cv). 

Then, later someone could change the data source by updating the string they entered (i.e. module/param1.f_cv to module/param2.f_cv)

4 Replies

  • Yes it's possible, I would recommend renaming the animation name instead of leaving the default.

    Thing you should be worried about is the data entry and if that parameter would actually exist. To resolve this make sure you add [_NOT_CONFIG_OK_] to the end of the animation so the interface won't give error dialog or you can have the user pick the supported names to ensure they don't fat finger.

    Once you have this named, saved, you can write logic similar to below for button to update link:

    Just be aware that the debugger will give you an error first but if you save, close and reopen the display the error will go away.

  • In reply to Matt Stoner:

    Thanks, Matt. This is EXACTLY what i was looking for. Thank you so much for this!
    I have two follow on questions:

    1.) In your script, does "CommandButton1" need to be clicked for the data source to actually change? I was hoping that Data Entry Expert could allow the operator to write to the "ParamNamedEntry.Caption" field, and then fmtMyAnimation.Source would update automatically without having to click on something else? I guess my question is, once you change "ParamNamedEntry.Caption" what is needed to initiate the data source to update?

    2.) Once "ParamNamedEntry.Caption" is updated online, is there a setting that I need to configure that allows that online value to be saved in the offline graphic file? Or do I need to create a script to save the file somehow (I didn't think that operate allowed you to save in online mode)?
  • In reply to Alex Lutz:

    1. Yes, There is no OnChange Event for Text, I just threw that together quickly to demonstrate and not sure it will work. You may have to use a local variable which would allow the OnChange event to occur and then you wouldn't need the Command Button to update.

    2. I don't think you can "save" the picture (wouldn't recommend it if you could) but you could create/read a file (difficult), save it to a global variable in User.fxg that would remain the value as long as operate remained open or write this parameter to a module that you could read when the picture opened and update the link. I would recommend either of the last two methods as they are much simplier and user friendly.
  • In reply to Matt Stoner:

    Hi Matt. This was very helpful. Is it also possible to change to source of a local variable? I am having trouble getting it to work. Maybe I am wasting my time.