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.  Variable as a parameter to use in Filename

    Employee
    Posted 03-18-2010 16:18

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

    Originally posted by: edith

    Hi All,

    How do I create a parameter from my brainscript? I would like to use part of my graph parameter as my filename. How do I manipulate it using brainscript then incorporate it into the filename? Filename only seems to take parameter values not variable created with brainscript.

    Below is a sample of what I like to do.

    Graph Parameter: BeginDate = 2010-01-01

    Script: ThisMonth= {{^BeginDate^}}.month()

    Output Delimited Node: File = {{^ThisMonth^}}.txt

    Thank-you.


  • 2.  RE: Variable as a parameter to use in Filename

    Employee
    Posted 03-19-2010 06:49

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

    Originally posted by: michaelslowey

    Edith,

    I refer you to this thread...

    http://community.mda-data.com/showthread.php?t=39

    It helped me do the same thing. Instead of using data from a file you can use a static data node with one field with the value of the parameter:

    eg;

    Field:String
    {{^dateParameter^}}

    Cheers
    Mick


  • 3.  RE: Variable as a parameter to use in Filename

    Employee
    Posted 03-19-2010 09:50

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

    Originally posted by: rboccuzzi

    You have it almost right. Parameters are always just textual substitution, so you want to do this:

    "{{^BeginDate^}}".toDate("CCYY-MM-DD").month() to get a month value from date parameter.

    And then, as the other thread shows, you can use the parameter formed to do a move from a hardcoded name to the desired name.

    Unfortunately, you can't currently provide BRAINscript for the file parameter to an output delimited node. You could include the parameter fully though, as in:

    c:/some/path/OutputFile_{{^BeginDate^}}.txt in the Output Delimited Node,

    and if that is good enough, you are all set, but if you need to, you could then follow it by a node that does a move, using moveFile in BRAINscript, creating the name using the format shown above to extract the month.

    Let us know if you need an example.

    Cheers
    Rich


  • 4.  RE: Variable as a parameter to use in Filename

    Employee
    Posted 03-19-2010 15:34

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

    Originally posted by: xathras

    hi rich, an example would be good


  • 5.  RE: Variable as a parameter to use in Filename

    Employee
    Posted 03-22-2010 11:06

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

    Originally posted by: ejones

    For an example of how to use moveFile, look at link Mick has earlier. After creating the file, you execute a filter node that contains moveFile to give the file the desired final name. Here is the link again: http://community.mda-data.com/showthread.php?t=39