I wanted to set a document in sequence try block, to the ‘document’ parameter value of pub.document:documentToXMLString service in sequence catch block. To get the value of a variable var1 in the catch block we use %lastError/pipeline/var1%. How will it be done for a document?
One of my clients approached this by developing a java service that would “recover” one or more variables from the lastError/pipeline.
Basically, the java service accepts the lastError/pipeline document and one or more keys or variable names to restore. For each key, the java service gets the value from the lastError/pipeline document and inserts it back into the pipeline for the service.
The “recovered” variables will not appear in the pipeline editor in Developer, but will exist in the pipeline and can be used in subsequent statements.
Check PSUtilities to see if there is something helpful there.
Writing a java service as Mark suggested is one way of “recovering” the variables from lastError/pipeline, but if you don’t want to use a java service, you can simply achieve this by mapping.
map [lastError/pipeline–>pipeline]
map [pipeline/ → var]
Here, in the second map step, create a document and indent it so that it becomes a child node inside pipeline, then map this document to whatever document you want. We are leveraging our knowledge of the fact that the ‘pipeline’ (extracted from lastError) contains the variable ‘document’ inside it at the runtime, its just that we don’t see it in the editor.
Hi Pauly,
Agreed with Mark/Rohit,
the way you are accessing variables in pipeline in catch block i.e. %lastError/pipeline/var1%
Same way you can access the document — >
%lastError/pipeline/document/var1%
pipeline document in lastError contains all the data (name-value pair) till error occurs in try sequence.