Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

process variable string into filename at Save service

Avatar

Former Community Member
Hello,



Does anyone know how to put a string into the Pathname Pattern (Template) property of a Save service (FileUtilsService - Write Document) ?



What I'm trying to do is strip the /'s out of a date string and put that date into a filename. For example, 042208_Greg.pdf



Instead I get d:\WMS\C0419\04\22\08\_Greg.pdf

I want: d:\WMS\C0419\042208_Greg.pdf



I have a Set Value service putting a form submit date (MM/DD/YY format) into a process variable called @stringDate. I am stripping /'s out of the date and setting @stringDate like so: /process_data/@stringDate <--- concat(substring(/process_data/xfaform/object/data/xdp/datasets/data/C0419/Approvers/Initiator/Date,1,2),substring(/process_data/xfaform/object/data/xdp/datasets/data/C0419/Approvers/Initiator/Date,4,5),substring(/process_data/xfaform/object/data/xdp/datasets/data/C0419/Approvers/Initiator/Date,7,8))



At the Save file service, I am using @stringDate in my Pathname Pattern (Template) to create the filename: d:\WMS\C0419\{/process_data/@stringDate}_{$/process_data/xfaform/object/data/xdp/datasets/data/C0419/Approvers/Initiator/CompletedBy/Name$}.pdf



Thanks,



Greg

Needham, MA
2 Replies

Avatar

Level 10
You should just have to add the string using the following format {$/process_data/@title$} in the template.



In your case it would be something like d:\WMS\C0419\{$/process_data/@stringDate$}_{$/process_data/xfaform/object/data/xdp/datasets/data/C0419/Approvers/Initiator/CompletedBy/Name$}.pdf



You almost already have it there.



Jasmin

Avatar

Level 9
Hi Greg

You've done a great job getting this done with xpath.

It looks to me like you've done everything right - what's not working - are you getting an exception, or is the file being saved with the wrong name?

There is a nice little DateFormatter component here, that might make things a little easier/flexible.

http://avoka.dnsalias.com/confluence/display/Public/Formatter+DSC



Howard