Expand my Community achievements bar.

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

Level 10

Are you using that schema in you pdf?

Jasmin

Avatar

Level 2

in the XDP form, I created the data connection using that schema,

then I [Save As] and created the PDF form.