cancel
Showing results for 
Search instead for 
Did you mean: 

Access Custom Attributes in JavaScript and in Transactions

Former Member
0 Kudos

Hello,

I try to work with custom attributes. I've problems accessing the values in JavaScript and in transactions, but it works fine within .irpt pages.

What's the trick?

For a custom attribute called PLANT, can I write something like this in JavaScript?

var p = ;

Is there a way to access custom attributes in the Link Editor of an Action Block?

Kind Regards,

Matthias

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Matthias,

it is not possible to integrate that kind of MII variables in JavaScript like you discribed before.

You are right that this kind of expression is possible in the .irpt file. The reason why it is working in the .irpt

but not in the .js is, that the MII script parser is only replacing in HTML content. Everywhere you have

scripting the parser will not replace the {...} markings (since the curly brackets also show start/end of functions aso.).

Variables to JavaScript

The easiest Way to get those variables is to create hidden fields in the .irpt file that you can access via JavaScript.

For example:

<input type="hidden" id="hidden_plant" value="{PLANT}" />

This will be parsed to (e.g.)

<input type="hidden" id="hidden_plant" value="Karlsruhe/DE" />

Now you can access this value in JavaScript via:

document.getElementById( "hidden_plant" ).value;

Variables to Transactions

To parse custom variables to a transaction you first have to specify corresponding transaction variables in the

transaction itself. After saving the transaction you can map those variables to Parameters in the Xacute-Query-Editor.

Including this transaction to your webpage you can simply assign the required value to the corresponding parameter.

For example if you mapped the Plant variable of the transaction to Param.1 you can specify the information in the .irpt

like:

<applet id="trx_test" ....>
  <... />
  <param name="Param.1" value="{PLANT}" />
</applet>

Another possibility is to set the value dynamically via JavaScript if you use:

document.getElementById( "trx_test" ).getQueryObject().setParam( 1, "Karlsruhe/DE" );

Native access to user variables via the BLE is not possible (as far as I know).

I hope this is what you wanted to hear?

Best Regards

Sebastian

Edited by: Sebastian Holzschuh on Jun 10, 2008 12:16 PM

Former Member
0 Kudos

Hello Sebastian,

thank you for your detailed response.

Yes, this was exactly what I wanted to hear : )

Cheers,

Matthias

Answers (1)

Answers (1)

Former Member
0 Kudos

Matthias,

you can parse the System Attributes and the Custom Attributes into a transaction. You need only to

define the Attributes in your transaction as Transaction.Property (case sensitive). Make sure that you

have the AutoBind property of the Xacute Connector (Data Server) checked. All System Attributes and

all Custom Attributes will be automatically passed when calling the transaction using an Xacute Query.

Please make sure, that you have not assign the System- and CustomAttribute to a Param. If you

mapped to a Param, then it will not work.

Regards

Pedro