2 Replies Latest reply on Jan 30, 2012 6:31 PM by TonyDatabase

    Problem passing field contents containing muiltiple paragraphs to script.

    TonyDatabase

      Title

      Problem passing field contents containing muiltiple paragraphs to script.

      Post

      I am not sure what I am doing wrong but I am trying pass the contents of a field to a script. The field is text with multiple paragraph returns inside. When I get the text directly with get ( ActiveFieldContents) the script runs fine but when I change the script to work with passed parameters the text get clipped at the first paragraph. I am passing the parameters like so:  List ( Get ( ActiveFieldTableName ) ; Get ( ActiveFieldName ) ;  Get ( ActiveFieldContents ) ) and I am calling them in the script with Set variable [$LocalVar: GetAsText ( ( GetValue ( Get ( ScriptParameter ) ; 1 ) ) ),  Set variable [$LocalVar: GetAsText ( ( GetValue ( Get ( ScriptParameter ) ; 2 ) ) ),  etc. I have the field contents as the last parameter in case it is empty. I could substitute the ∏s with a placeholder but that seems like more work then it is worth. I could use a global var too but I would like to figure this one out with parameters as it is cleaner. Please help, I am probably missing something obvious here.

        • 1. Re: Problem passing field contents containing muiltiple paragraphs to script.
          philmodjunk

          Get Value returns a single value from a list of values separated by returns (your paragraph symbols). Thus, if the contents of the active field is more than one paragraph of text with paragraphs separated by returns, it will only extract the first paragraph from your script parameter.

          This expression will extract a multi-paragraph block of text as the last parameter in your list of values:

          Let ( p = Get ( ScriptParameter ) ; RightValues ( p ; ValueCount ( p ) - 2 ) )

          Since this leaves a return as the last character you might need to add additional code to strip off that added return if it is not wanted.

          You can also use a different method for passign multiple values to your script.

          Your parameter expression could be:

          "$TableName = "Let ( [ & & Get ( ActiveFieldTableName ) & "; $FieldName = " & Get ( ActiveFieldName ) & "; $Contents = " & Get ( ActiveFieldContents ) & "]; 1 " )

          Then use this expression to create the three variables and assign values to them:

          Set Variable [$Dummy ; value: Evaluate ( Get (ScriptParameter ) ) ]

          • 2. Re: Problem passing field contents containing muiltiple paragraphs to script.
            TonyDatabase

            Thanks so much PhilModjunk for the quick response and explaination. I think I will use the valuecount approach as I am cleaning up the text anyway so the extra return is not a problem