Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

concatenate text and value

Avatar

Level 2

Dear All,

I'm new in adobe livecycle scripting and I have a simple question.

I have a dropdownlist which is binding with a SAP table containing a SAP code and a description.

Is it possible to concatenate the code and the description and to display it in the dropdowlist. The user could choose this and after when I need to take into account the choice of the user, I would like to have only the code

In my table, I have a table with the material type and the description

In the dropdownlist, I would like to have :

ZSAL - finished product

ZPRO - promotionnal product

And in output I need to have only the code ZSAL or ZPRO.

I hope my question is clear.

Thanks for your help.

Kind regards

Véronique

2 Replies

Avatar

Former Community Member

Véronique,

There are several ways to get this done. One choice is dependent upon how you bind the data from the table to the drop-down. Typically form developers populate the listed items but they do not specify item values on the Binding tab.

p1.png

If so 'Specify Item Values' you can separate the values display in the drop-down and the value you actually want to process. In the example, I added the SAP codes as values.

p2.png

In the drop-down exit event I added added two options for getting the value.

// form1.page1.subform1.sapCodeTable::exit - (JavaScript, client)


form1.page1.subform1.sapCode.rawValue = this.getSaveItem(this.selectedIndex);


var selectedText = this.rawValue;

form1.page1.subform1.parsedValue.rawValue = selectedText.substring(0,4);

The first option uses the object model to extract the value. However, if you do not explicitly bind the value items when you get the data from SAP, this option is not available.

The second option simply parses the code value from the raw text, assuming the code is always 4 digits.

Steve

Avatar

Level 2

Dear Steve,

thanks for your answer.

In fact my dropdownlist is binded with an SAP table which contains SAP material type and description.

The first solution is not good for me because I don't want to put "hard value" in the adobe form.

I tried your code but it doesn't work. I think I don't do it properly.

More details :

     -> in the data view I have the table TT023T - DATA - ( MATKL, WGBEZ)

     -> in the hierarchy I have the dropdownlist : form_corp2.sform_corp.MATKL

In the Object tab, Binding, I don't know what I have to put in the default binding and in the link Specify item values.

For the moment I have : $record.TT023T.DATA[*].MATKL in the default binding and

in the dynamic properties :

items : $record.TT023T.DATA[*]

text : WGBEZ

value : MATKL

But with this, I have only the WGBEZ in the dropdownlist value list.

I want to concatenate "MATKL - WGBEZ" in the dropdownlist value list.

The last solution is to have directly from SAP table the concatenation in a field and bind it  to the item text but I would like to try with the script.

Thanks

Kind regards

Véronique