LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Printing parameter value containng quotes in a field

    Employee
    Posted 08-14-2013 06:58

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: aop

    Hi!

    I'd need to print a parameter value as a string in a field. My problem is that the paramater value contains quotes (") so emit "{{^Parameter^}}" as Field does not work. As the parameter value contains brainscript used elsewhere I cannot use double quotes in the parameter value. Is there possibly some trick I could use to get around this?

    Thanks in advance!


  • 2.  RE: Printing parameter value containng quotes in a field

    Employee
    Posted 08-14-2013 14:04

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ltolleson

    You will need to put a backslash in front of the quote character in your parameter value. The backslash is the escape character and allows the parameter and BrainScript code to recognize the quote character as a literal value.

    See the "String and Unicode Literals" section under the BRAINScript help for more detailed information.

    Thanks,
    Larry


  • 3.  RE: Printing parameter value containng quotes in a field

    Employee
    Posted 08-15-2013 05:27

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    I just thought I'd mention that in the next version of the LAE (LAE 4.6.1), there will be a funciton to allow you to extract the value of a parameter within BRAINscript.
    This will ensure that you don't need to worry about escape characters for quotes and newlines etc within your parameter values - which is particularly useful if you are not setting the parameters yourself, but are trying to write a generic node where someone else will be setting the parameter values.

    The parameter you want to use will need a Runtime Property Name associated.
    You can setup the Runtime Property Name in the node editor in the Parameter Declarations dialog.

    Once this is done, then if you have a parameter "MyParam", with a Runtime Property Name of "ls.brain.node.myNode.myParam", then you could do what you want using the following BRAINscript:

    val = property("ls.brain.node.myNode.myParam")
    emit val as "Field"
    As mentioned, this isn't available yet, but will be in the upcoming 4.6.1 release.

    Regards,
    Tim.


  • 4.  RE: Printing parameter value containng quotes in a field

    Employee
    Posted 10-24-2013 05:10

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: aop

    Hi!

    Can you confirm that this was implemented in 4.6.1 as I could not get the syntax to work?


  • 5.  RE: Printing parameter value containng quotes in a field

    Employee
    Posted 10-24-2013 09:46

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    When defining the parameter, you must fill in the "Run Time Property Name"
    It should be of the general form ls.brain.node.myNode.<parametername>
    Once you fill that in, then property() should work correctly.


  • 6.  RE: Printing parameter value containng quotes in a field

    Employee
    Posted 10-25-2013 05:49

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: aop

    It seems my problem was that the parameter is set on a higher level (on a composite level) rather than on the level of then node where I'm trying access the property. Can I somehow use property function for parameters set on composite or graph level?


  • 7.  RE: Printing parameter value containng quotes in a field

    Employee
    Posted 10-27-2013 05:47

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    You need to have a parameter with that runtime property name defined on the node where you are using the "property" function.
    You can, however, have the value of the parameter come from a graph level, or composite level parameter.

    Essentially, all the normal rules parameter inheritance and composition and textual substitution apply when accessing the property values.
    However, in order to access the value for a parameter with a corresponding runtime property name, the runtime property name must be defined on the node where you are using the "property" function, or on a node that it inherits from - not from a graph level parameter or from a composite node that contains your node.

    For instance, consider the case where you want to access the value for a parameter MyParam on a node "N".
    You would declare the parameter "MyParam" on the node itself, and then could give it a runtime property name of "prop.myParam".
    Then, within the node code, you can access the parameter value using:
    property("prop.myParam")

    However, you don't need to set the actual value of MyParam on that node.
    You could declare a graph-level parameter "MyParam", and have its value set to "ParamValue".
    Then, in node "N", property("prop.myParam") would evaluate to "ParamValue".

    Similarly, you could declare a graph-level parameter "MyGraphParam" and have its value set to "ParamValue".
    Then in node "N", you could set the value of MyParam to {{^MyGraphParam^}} - and on node "N", property("prop.myParam") would still evaluate to "ParamValue".

    Hope this helps,

    Tim.