Avatar

Level 4
Level 4

I've made an xdp whose fields match an xsd. Now if the xml that populates the form looks like this:

<a>

  <a1>1000</a1>

  <a2>credit</a2>

<a>

<a>

  <a1>1400</a1>

  <a2>debit</a2>

<a>

...I would like the data in field a1 to be preceded by a minus-sign IF and only if a2 for the same record equals the string "credit".

The problem is that I cannot seem to get a hold of the record pointer/current record during population. I'm looking for something along the (js-)lines of:

a1::someEvent

if ($record.a2 === "credit") this.rawValue = "-" + $record.a1;

I'm looking for a 'hygienic' solution that doesn't involve dumping a2 into a hidden field.

Any clues?