cancel
Showing results for 
Search instead for 
Did you mean: 

find value in table from interface in offline form

Former Member
0 Kudos

Hello,

Here is my issue :

I have a dropdown with values that are dynamically defined from SAP through the interface. The table for the interface is defined like this :

MATNR MAKTX CATEGORY

123456 material 1 8

646788 material 2 3

689865 material 3 4

I would like to show a popup if the category of the material is 4.

In the event "change" of the dropdown, I would like to get the category from the table but I don't know how to do that.

I know that I can get the value of maktx with xfa.event.prevText but I would prefer get the matnr value. And then I don't know how to read the table to get the category.

Please help me ! thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

NoJo
Active Participant
0 Kudos

//Javascript! Data is stored in Table MATTAB

// MATNR is source Field, CAT is target field

//get the value -->

var selection = this.boundItem(xfa.event.newText);

//then search in the table mattab (dataview --> table MATTAB, repeating node DATA,Colums matnr, maktx, category) -->

var nodMatnr = xfa.resolveNodes("xfa.record.MATTAB.DATA[*].matnr");

var nodCat = xfa.resolveNodes("xfa.record.MATTAB.DATA[*].category");

//target Fieldname in Form = MAKTX in same subform

for ( var i = 0; i < nodMatnr.length; i++ ){

if (nodMatnr.item(i).value == selection){

CAT.rawValue = nodCat.item(i).value);

} //if

} //for

Former Member
0 Kudos

Thank you very much.

But I think that the .lenght doesn't work and I don't know why :

I wrote : xfa.host.messageBox(nodMatnr.length, "test", 2);

And I get a popup with empty value.

Btw, could you tell me if there is a way to control the code without having to generate the PDF for testing ?

chintan_virani
Active Contributor
0 Kudos

The API works in following manner:-

xfa.host.messageBox("message", icon, buttons)

method where the icon parameter is 0 (error) to 3 (status) and the buttons parameter is 0 (OK), 1 (OK, cancel), 2 (yes, no), 3 (yes, no, cancel).

So write

xfa.host.messageBox(""+nodMatnr.length, 2, 2);

Chintan

Edited by: Chintan Virani on Oct 7, 2009 3:23 PM

Former Member
0 Kudos

Thank you, but now it returns "undefined"

chintan_virani
Active Contributor
0 Kudos

That means its not able to find the node. Use proper node hierarchy as per your form.

Also I did a change to my earlier post, see if it helps.

Chintan

Former Member
0 Kudos

Thanks again, but when i write :

xfa.host.messageBox(nodCat.item(1).value, "test", 2);

I can see the value of the first line, so I think that it found the node...

EDIT : Sorry, it's working.

Edited by: Louis-Arnaud Bouquin on Oct 7, 2009 12:12 PM

Answers (0)