This content has been marked as final. Show 7 replies
I found the problem. The "Read String" activity's output variable must be of type "binary", not "string".
This is actually quite ironic:
- The activity is called "Read String", emphasis on *string*, but the output variable can't be a of type "string".
- The process works with a variable of type "binary", but if you try to load a binary file (ie, a PDF) the result is corrupted with a bunch of '?' characters (or is that just the logger that's corrupting it?).
OK, so my previous solution does not work very well. Converting from 'binary' to 'string' does not seem to be easy. Assigning the binary variable to a string variable results in gibberish, even with the string() function. The good news is I found a better solution:
- Save your parameters as an XML document.
- In your Read String activity, use a 'xml' type variable as the output.
So, take this basic XML code for an example:
If you save this to your watched folder and read into an 'xml' variable named 'myXml' using the Read String activity, you'll be able to do the following (assuming myString is a 'string' variable)
/process_data/@myString = /process_data/myXml/drink
/process_data/@myString = /process_data/myXml/pizza/top1
Let's take a step back here.
The Read String activity will read the content of a file that contains strings into a STRING variable. In fact you need to provide a variable of type string for the output results.
I think the problem is that your trying to read XML content which is not treated as a string by LiveCycle.
If you want to read XML content then use the Read Document activity. It'll put the content of the XML in a document variable. Then you can use a SetValue and put the content of the document variable into a XML variable and use xPath to get to the value you need.
/process_data/myXML = /process_data/myDocument
You have to use a XML variable if you want to use xPath. xPath won't work on a string variable since the string content doesn't really have structure. You need a XML variable which gives you the structure.
If you really want to, you can convert the XML into a string (using the serialize xPath function) and have the XML treated as a string but I don't think that's what you're trying to do.
If I use a 'string' variable with the Read String activity, the process stalls with this error:
Data truncation: Data too long for column 'doccontent' at row 1; CausedByException is:
Data truncation: Data too long for column 'doccontent' at row 1
I tried this with a brand new, basic process that had only two activities: the Read String and a logger.
I only used an 'xml' variable when I couldn't get it to work with a 'string' variable.
The content of the file I was trying to read directly into a variable contained only one line of text (a path). I now changed this to an XML document and it works...
"Data truncation: Data too long for column 'doccontent' at row 1; CausedByException is: "
Make sure the length of your sting variable is big enough to hold the path information. You can change it under properties.
I left the length field blank. The source file was like ~50 bytes.
Then put a length that will hold 50 bytes of data. Just put 1000 or something.