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.  BrainScript string literal across multiple lines

    Employee
    Posted 07-19-2011 16:57

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

    Originally posted by: mermacora

    Is there a way to continue a BrainScript string literal across multiple lines?
    The only way I know to do this is to use strcat(), for example...

    myString = strcat(
    �line1�,
    �line2�,
    �line3�
    )


    This approach is cumbersome, and I often need to do this for long SQL statements when I need to run in a DB Execute node.

    Cheers,
    Mario


  • 2.  RE: BrainScript string literal across multiple lines

    Employee
    Posted 07-20-2011 05:32

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

    Originally posted by: jodycrutchfield

    Mario,

    Here is how I get around it in the DBExecute node.

    Declare a parameter on the node called Query as type sql. Then you can have sql on multiple lines and build the sqlSelect line in the script section.

    Here is an example.

    node:DB_Execute
    bretype:core::DB Execute
    editor:sortkey=4e26c64d688a7802
    output:4e26c67156003181/out1=
    prop:Query=<<EOX
    select *
    from sometable
    where value = :1
    EOX
    prop:Script=<<EOX
    sqlSelect(1,"{{^Query^}}",InputCol)
    EOX
    editor:XY=430,140
    editor:propdef=Query|sql|1||None
    end:DB_Execute


  • 3.  RE: BrainScript string literal across multiple lines

    Employee
    Posted 07-20-2011 06:38

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

    Originally posted by: rboccuzzi

    This is a little less cumbersome, and how I do it:
    myString = “line1” +
    “line2” +
    “line3”
    Of course, you can also just do
    myString = "
    line1
    line2
    line3
    ".replace("\n","")
    which might be nicer if you are pasting a big block of strings and don't want to deal with the quotes on each line.

    Cheers
    Rich