Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Referencing Variables Question

Avatar

Level 3

Hi,

Can someone please explain to me what is the use of the @ sign when referencing a variable in Workbench?

For example: /process_data/@myVar

Sometimes you need to use it, sometimes you don't, sometimes Workbench adds it for you but you shouldn't be using it, I'm confused.

If you have a link to the online help explaining this, that would be awesome.

Thanks

Nic

1 Accepted Solution

Avatar

Correct answer by
Level 10

The @ symbol is used to get the value of a node when it's a simple data type(string, int, long,etc).

At one point all variables get converted internally into an xml structure. That's why we can use xPath to get the value.

If you have a simple type, which can return only one value (string, int, long, etc), then you use the @ symbol.

If you have a complex object (for example FormsResult), then it depends which node you query. If you want to get the value of the action the xPath will be /process_data/test/object/@action. You get the @action, because it returns a string for that property.

If you want to get the list of attachents, then the xPath is /process_data/test/object/attachments. The attachments property doesn't contain a @ because it's not a simple type but a complex type (list of attachments).

Also the xml variable is considered a complex type.

I've never experienced a case when Workbench added the @ and I didn't need to use it.  Let me know if you have a specific example.

Jasmin

View solution in original post

22 Replies

Avatar

Correct answer by
Level 10

The @ symbol is used to get the value of a node when it's a simple data type(string, int, long,etc).

At one point all variables get converted internally into an xml structure. That's why we can use xPath to get the value.

If you have a simple type, which can return only one value (string, int, long, etc), then you use the @ symbol.

If you have a complex object (for example FormsResult), then it depends which node you query. If you want to get the value of the action the xPath will be /process_data/test/object/@action. You get the @action, because it returns a string for that property.

If you want to get the list of attachents, then the xPath is /process_data/test/object/attachments. The attachments property doesn't contain a @ because it's not a simple type but a complex type (list of attachments).

Also the xml variable is considered a complex type.

I've never experienced a case when Workbench added the @ and I didn't need to use it.  Let me know if you have a specific example.

Jasmin

Avatar

Level 3

Thanks for the great answer Jasmin. I believe we had already talked about the @ issue before. I discovered it when doing tests using the byte type.

It's pretty easy to reproduce, jut try setting a value to it and you'll encounter the issue. I've also opened a ticked with support about this.

Thanks

Nic

Avatar

Level 2

Hi, maybe I should have started a new thread,

but this is sort of about manipulating the Document variable....

anyways, this is what I want to do:

have a simple form, several text fields on it, plus a signature field,

route it through a simple workflow/process,

everything is running in the out-of-the-box Workspace environment.  no customization.

in the User task, Presentation & Data tab, I use a Document variable,

I want to be able to get the data in those text fields on the form in a Set Value task of the process,

how do I do that?

It seems that I can't have xPath on a Document variable...

if I use a "xml" variable, the signature doesn't seem to work.

product is ES2, version 9.0

thanks

Avatar

Level 10

You can use the Form Data Integration->ExportData to export the XML from the document varibale (which contains the PDF) into an xml variable.

Then you can use xPath to extract the infomation from that xml variable.

Jasmin

Avatar

Level 2

Hi,  does it matter if the form ("asset" in ES2) is an XDP or a PDF?

My form is .XDP and when I tried the ExportData it stalled.

In previous versions, the variables in the process can have the "xdp" type (if I remember correctly),

but in ES2, there's a "Document" type, and a "xml" type, but no XDP type.

I am all confused.

thanks

Avatar

Level 8

XDP is a template and not a rendered document. If you want to extract data then it would come from a PDF.

Avatar

Level 2

may I ask a stupid question?

in previous versions of LCs, there's a "xfaForm" variable type that I can use xPath to get the field data on the form.

But in ES2, version 9.0, I can't find that type anymore. 

Could you tell me what's the equivalent of xfaForm in ES2 ?

in ES2, there's "xml" variable type, but how do I load the form data into a xml variable if my form is a .XDP ?

thanks

Avatar

Level 10

You're right, now we just have an xml variable.

Just make sure to set an xml variable in the Output->Output Data section of the user step.

Jasmin

Avatar

Level 8

Jas is right, the best idea would be to have the form return XML data.

If your stuck with an XDP at the server side: An XDP document is really just a specifically formatted XML.  You could load the XDP directly into an xml variable and then parse it from there.  I believe your data would be in a datasets\data node.

Avatar

Level 2

my server is down right now, so I can't verify this,

but if I remember correctly,

at the Start Point step, the only variable listed in the "Output" tab is a Document variable...

I saw my "xml" variable in the subsequent User steps. But not in the initial step.

so, what should I do at the Start point?

Avatar

Level 10

You can still put a xml variable in there (Start Point Output -> variable). The reason it says document is because this is more generic. A document can handle pdf or xml, but if you know it's going to be xml, you can specify a xml variable and it'll work.

Jasmin

Avatar

Level 2

please correct me if I am wrong...

if I use .XDP asset with a xml variable, and use that as the Input to the downstream User task,

then the Signature would disappear:

    Sign the signature field at the Initiation, but can't see the Signature at the User task.

so, is it true that:

in order to let the Signature along with other text field data to show up at the User task,

I will need to use a PDF form as the asset,

and use a Document variable as the Input/Output,

and use the ExportData service to get the field data on the form?

or there are other ways to do this?

thanks

Avatar

Level 8

Rather than answer the question bit by bit, perhaps it would be better to back up and look at the use case as a whole.  Can you describe to us the process at a higher level?

Avatar

Level 2

the process/workflow is really simple:

start ---> SetValue (where I want to populate a text field on the form, based on what the user has already entered in other text fields) --> User task (approver) --> User task (Initiator)

the form has several Text fields, and 2 Signature fields,

the Initiator signs one signature field,

the Approver signs the other.

----

so,

I tried to use .XDP as the Asset, I can see that my "SetValue" worked, but I lost the Signature at the User steps.

I can use .XDP and a Document variable as Output/Input, then I can see the Signature, but I can't do the SetValue.

so, it seems to me, the only option left is to use .PDF asset with a Document variable.

thanks

Avatar

Level 10

Ok. On the Start Point, you can use and XDP.

If you need digital signatures, you need to make sure the submit button submit the entire PDF.

In the Output section from the Start Point you want to use a document variable so that it contains the entire PDF.

Then you need to use another service (like Form Data Integration) to extract the xml from the PDF.

For the subsequent user steps, you cannot use an XDP anymore. You would use the document variable that contains the PDF.

Jasmin

Avatar

Level 2

Thank you all for answering my questions.  My server is still down, so I can't report Success on trying out your solution yet, but I trust that it will work.

One last question:

you mentioned that at subsequent steps I can't use XDP anymore.  I'd like to know is there anything that I can't do with the PDF and Document variable?  Is there anything I must use XDP and not Document?   If I can do everything with PDF and Document variable, then I won't bother using XDP anymore.

thanks

Avatar

Level 10

You can do everything with PDF.

You just need to manually extract the xml data every times.

Jasmin

Avatar

Level 2

Hi, the ExportData's output (xml variable) contains this in the Playback:

<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
    <xfa:data>
        <form1>
            <AWS_TASKID>5101</AWS_TASKID>
            <AWS_CHOICE/>
            <AWS_STATUS>1</AWS_STATUS>
            <AWS_MAILTO/>
            <AWS_ACTION/>
            <AWS_ASSIGNED_ID>08155102-C83E-102D-A7EE-0000AC1F5833</AWS_ASSIGNED_ID>
            <FSTARGETURL_/>
            <xfdf:field xmlns:xfdf="http://ns.adobe.com/xfdf/" xmlns:xfdfi="http://ns.adobe.com/xfdf-transition/" xfdfi:original="FSAPPLICATIONDATA_">H4sIAAAAAAAAAJVT70+kMBD9VzZ8h4Kb9bgNW1OhKN7+8CjE+IlU6Co5oYT2br3//qYsq3jGD5KQ9M2892aGDsHFS/M8+yN6Vct2ZXmOa81EW8qqbh9XVp7Ftm9d4OCl6pbwzoDcKnNaWU9ad0uEWuXwSj4Ip5QNggSygL3ny4prroRWJ8mev0oOh4MD2JH9I1Llk2g4AmgbBYIGpg442Mu+8XBA7liREfYjifDCc70ATQJDMrzeJSFFR8AykuUMj7QRDZkNSdbZbqSRMEt22xNgLLna0qgAR9f3FlDmzA79ObXhENnkG6W2Cw8JvXjhz+dH76kqiKFSekWzPF0X4IrG3v8LA6Sb2zXJaAGcdyhm8S7d/Mxpel9gRLruuS65hptR6CYSQgulhy8Ug/HC6aq90U8kxjsl2yFEzGxJVODbKDb8odSH5Lvm8OmCuDKl3LPld9c/RwfZ/1IdL4WtRA+rgtTvh6bWn8WHQm+eUIHcpV/0Nh6DCtSfi81YbJAZ/kgP0zxNCtyLTqpay/4v6Ex6jAPjkjD69XGNx6syQG8biqbrbuDxX8H/ACKYbUJbAwAA</xfdf:field>
            <xfdf:field xmlns:xfdf="http://ns.adobe.com/xfdf/" xmlns:xfdfi="http://ns.adobe.com/xfdf-transition/" xfdfi:original="FSTARGETURL_">http://wastest02:9086/workspace-server/submit/workspace-server/submit</xfdf:field>
            <Name>aaaaa</Name>
            <rank>bbb</rank>
            <sno>55555</sno>
            <field4/>
        </form1>
        <FSTARGETURL_/>
        <FSTEMPLATE_/>
        <FSFORMQUERY_>/Applications/JDeetest/1.0/Form5.pdf</FSFORMQUERY_>
        <FSTRANSFORMATIONID_>PDFForm</FSTRANSFORMATIONID_>
        <FSTARGETURL_>http://wastest02:9086/workspace-server/submit/workspace-server/submit</FSTARGETURL_>
        <FSAWR_>http://wastest02:9086/workspace-server/submit</FSAWR_>
        <FSWR_>http://wastest02:9086/FormServer</FSWR_>
        <FSCRURI_>repository://</FSCRURI_>
        <FSBASEURL_>http://wastest02:9086/workspace-server/submit</FSBASEURL_>
    </xfa:data>
    <dd:dataDescription xmlns:dd="http://ns.adobe.com/data-description/" dd:name="test">
        <test>
            <Name/>
            <rank/>
            <sno/>
            <field4/>
        </test>
    </dd:dataDescription>
</xfa:datasets>

I see the data on the form are in the <form1>

but in the xPath, when I drill down, there's no form1, only the <test>,

how do I get my form data?

what have I done wrong?

thanks

Avatar

Level 2

yes.   schema root is <test>.