• Not Answered

Live datalink write limit

Configure had the option to set limits on a write. I don't recall if this was a wizard or built into the animations dialog, but i'm not finding an equivalent in Live.

9 Replies

  • Use an OnWrite fuction to set limits. Check out the Graphics Studio help and it has an example of an OnWrite used to limit an numeric input to a hardcoded range.
  • Another option is you can open the Contextual Display DataEntry under Emerson/Support and pass Tag/Window Title (Tag), ParameterPath (Context1), Confirmation (Context2), Low Limit (Context3), Hi Limit (Context4).
  • In reply to Jesse Delanoy:

    yeah, except it doens't really tell me how to use it.. as in.. where to place this function...
  • In reply to TreyB:

    Jesse's suggestion is an Interaction Event for like a Display Variable (which doesn't work for the Datalink Write Value but not sure where you are wanting to write a value and limit it). You can use the scaling of the parameter for the limits for a datalink write and it will use those I believe but that might mess up other things for what you are doing.

    So remaining I believe is only using the Data Entry CD or custom scripting unfortunately. Using the Data Entry is probably the easiest and will be using the same data entry method that others entries are using.
  • In reply to Matt Stoner:

    Not having luck with this and i'm guessing it is how i set up the contexts..

  • In reply to Matt Stoner:

    Thanks for the clarification Matt. I had not actually tried the OnWrite function. I tested this a little today and I see it can't write to a control tag, only a graphics variable. Also I ran into some scripting issues when I copied the help example.
    I was unable to get the script variable "finalValue" to work for me as I kept getting an error saying I can't write to a constant or read only variable. I had to modify the script as shown below to get past this error.

    if (newValue < 0) {
    return 0;
    }
    else if (newValue > 100){
    return 100;
    }
    return newValue;



    I also tested calling the Data Entry window directly from a datalink with a click interaction set to custom script. I grabbed the script from the default CD_popUpEntry and modified it to work in a non GEM configuration. This seemed to work well in my limited testing, and is definitely the better approach as the operator can see what the actual limits are set before attempting to write a new value. Below is the script I used within the datalink interaction to call up the Data Entry window. For the quick test I just hardcoded everything, but this could be improved by creating a datalink GEM with configuration properties.

    let display = DL.DN("DataEntry");
    let confirm = "true";

    let rangelow = String(0);
    let rangehigh = String(150);

    let region = DL.GetDisplayElementRegion(Dsp.DataLink4);
    let pos = new Types.Placement({
    Option: Constants.PlacementOption.NearRegion,
    Region: region,
    UseCachedPosition: false
    });

    DL.OpenContextDisplayAsync(display,"Data Entry",[pos],"LIVE_TEST/PARAM1",confirm, rangelow, rangehigh);
  • In reply to TreyB:

    The optional contexts need to return strings.

    Context 1 should be setup with DLPATH.ParameterPath(Dsp.Tag + '/VOLUME.CV')

    Context 3 and 4 need to be converted to a string: String(DLSYS[Dsp.Tag+'/VOLUME_HIGH.CV'])


    I tested this and it works the same as using the custom script option. The one issue I see is reading the upper and lower limits from the control module doesn't load the values the first time the DataEntry window is opened. I thought this was just happening once after publishing, but I closed Live, re-opened and the same issue occurred where the limits were not populated. My Live scripting knowledge is limited... might be a Matt question to see if there is a better approach to ensure the limit values load every time.
  • In reply to Jesse Delanoy:

    I have seen this issue before but I the way I have been solving is by having the limits be object variables (Dsp, Gem, Group, etc) and are linked with animiations so the read is established when it opens and not when clicked.
  • In reply to Jesse Delanoy:

    i was able to reload LIVE and didn't have the issue recur.. i'm going to roll with it for now until i see it not work. Thanks