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.  ERROR Creating BRX

    Employee
    Posted 12-13-2014 06:57

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

    Originally posted by: abhisek

    I received an error while creating the brx from brg.

    I had executed the brg. It ran successfully. When I tried to create the brx, I got an error message "Unexpected token", but the brx was create.

    Error:
    e1.jpg

    On further analysis, I found the error was showing in regards to filter node. The brx details of the filter node is detailed below.
    e2.jpg

    Now the problem is why was this error message shown.

    I have not executed brx uptill now to check whether it can executed successfully or not.
    Attachments:
    brx.txt


  • 2.  RE: ERROR Creating BRX

    Employee
    Posted 12-13-2014 09:04

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

    Originally posted by: ejones

    My experience with errors during BRX creation, is that the BRX is only partially created. The compilation of the BRX evidently stops at the point where the error occurred and did not finish.

    When I've had a working BRG and get errors when trying to create the BRX, it usually is caused by a combination of BRAINscript code and the values of Run Parameters it references. Would you be able to post the BRAINscript code, the values, and types of any Run Parameters?


  • 3.  RE: ERROR Creating BRX

    Employee
    Posted 12-13-2014 12:18

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

    Originally posted by: abhisek

    The brainscript code is as follows

    			
    				emit *
    where Data_Changed >= {{^RunDTM^}} or Data_Created >= {{^RunDTM^}}

    ejones
    You have pointed correctly. It can be because of the combination of Brainscript code and the values of Run Parameter. But

    This conditions I had used many times in the code. I don't know why it is giving this error when I am using it with filter node.


  • 4.  RE: ERROR Creating BRX

    Employee
    Posted 12-13-2014 18:39

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

    Originally posted by: stonysmith

    Is the parameter RunDTM defined and does it have a value?


  • 5.  RE: ERROR Creating BRX

    Employee
    Posted 12-14-2014 05:36

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

    Originally posted by: ejones

    Oh good. This is a situation I've seen before.

    The answer is to change the BRAINscript to this:

    emit *
    where Data_Changed >= int("{{^RunDTM^}}") or Data_Created >= int("{{^RunDTM^}}")

    The rule is, "all Run Parameters referenced in BRAINscript code must be surrounded by double quotes."

    In this case following that rule turns the value into a string value and you must override this by converting it back to a number using the int() function.

    The reason is a little difficult to explain but I'll try. Without the double quotes around {{^RunDTM^}} then the stuff in the parameter will be interpreted as BRAINscript code and compiled. There are two points of time involved, a) the time you create the BRX, and b) the time the BRX executes. To work correctly, all the BRAINscript code must be available when you create the BRX, but because the value in the Run Parameter is not available until the graph executes the BRX creation step is not able to work, it gets a bit flustered and gives you this error message about finding an unexpected "{" character.

    So, think of it this way, when you are creating the BRX, the value in the Run Parameter causes the code to look like this. Note the {{$$}} is used internally to mark values that won't be available until the BRX executes.
    emit *
    where Data_Changed >= {{$RunDTM$}} or Data_Created >= {{$RunDTM$}}
    But that code is not valid BRAINscript so it is unable to compile. And when you look at this version of the BRAINscript it makes more sense that it complains about an unexpected "{" character.

    Now look at what happens when you put double quotes around the {{^RunDTM^}} value:
    emit *
    where Data_Changed >= int("{{$RunDTM$}}") or Data_Created >= int("{{$RunDTM$}}")
    In this case, it is ok to not know the value until the BRX executes. The compiled version of the node can be saved in the BRX and a simple replacement operation when it executes can be done.