1 person found this helpful
You can use the setDocAttribute function. The syntax is "setDocAttribute(com.adobe.idp.Document, String, String". Check the Workbench Help for more detail.
Thanks for the quick response. This looks like it should work to change the wsfilename, but how do I go through the map of documents and use the setDocAttribute on each document?
You'll have to touch each document in your map individually by writing a loop (or using java code in a script operation). To get at a value in a Map use the syntax /process_data/myMap[@id="myKey"] where myMap is the name of your map variable and mykey is the name of the entry in the map object
Thanks for the information Hodmi. I'm trying to access each section of the map but it does not seem to be working. First, I'm getting the keys for the document map with the get-map-keys function. Then I am trying to modify the first document in the map with this:
setDocAttribute(/process_data/MapOfDocuments[@id='/process_data/MapKeys'], "wsfilename", "test.doc")
When I run this it does not change the first document name. Any ideas why it isn't changing?
1 person found this helpful
The problem is that you put the id in quotes - which no longer evaluates the statement, but treats it as a litteral.
To make it easier on my feeble brain (especially when debugging using record/playback) I break it down into multiple steps in the same set value
/process_data/@myTempID is a string
/process_data/@myTempDocis a Document
Location Expression /process_data/@myTempID /process_data/MapKeys /process_data/@myTempDoc /process_data/MapOfDocuments[@id=/process_data/@myTempID] /process_data/MapOfDocuments[@id=/process_data/@myTempID] setDocAttribute(/process_data/@myTempDoc, "wsfilename", "test.doc")
Thanks again for your help Hodmi. I'm now having trouble getting the MapKeys into a list of strings though. Right now I have the get-map-keys being assigned to a list of strings variable, but I am getting an error saying that it cannot be stored for action instance. I'm getting this warning in the server log:
2009-07-27 11:08:18,729 WARN [com.adobe.workflow.AWS] com.adobe.workflow.WorkflowRuntimeException: Invalid location: /process_data/@MapKeys cannot be stored for action instance: 2417
and then this error:
2009-07-27 11:08:18,729 ERROR [com.adobe.workflow.AWS] stalling action-instance: 2417 with message: Invalid location: /process_data/@MapKeys cannot be stored for action instance: 2417: com.adobe.workflow.WorkflowRuntimeException: Invalid location: /process_data/@MapKeys cannot be stored for action instance: 2417
For Location I have /process_data/@MapKeys and in Expression I have get-map-keys(/process_data/MapOfDocuments). Any ideas why I would be getting this error? Thanks again for any help. I'm still learning a lot of this as I go.
I think its a syntax thing. I did a quick check and my processes don't use the @ symbol with lists and maps (only simple types)
Location Expression /process_data/MapKeys get-map-keys(/process_data/MapOfDocuments)
Perfect, thanks for all the help!