cancel
Showing results for 
Search instead for 
Did you mean: 

How to deal with context dependant code lists?

ralf_baumann
Advisor
Advisor
1,982

Hi ByD studio forum,

recently one of the ByD solution partner raised an interesting questing regarding context dependant codelists. I create this thread to share the question and the answers (provided by Thomas Schneider) to it with the community.

Most of the ByD codelists are context independant and contain a list of unique values. Some of the codelists (i.e. WorkAgreementAdministrativeCategoryCode) are context dependant and the code value is only unique within a certain context, i.e. country, region.

Example - WorkAgreementAdministrativeCategoryCode:

List IDCode ValueDescription
AT1Hourly
AT2Salaried Employee
AT3Manager
AU1Hourly
AU2Salaried Employee
AU3Manager
BE1Hourly
BE2Salaried Employee
BE3Manager
BR1Salaried Employee

In a custom BO a element typed with an context dependant codelist is defined and should be placed on a custom UI.

import AP.Common.GDT as apCommonGDT;

businessobject CodeListMapping_Test {

             element CustomerWorkAgreementAdministrativeCategoryCode : WorkAgreementAdministrativeCategoryCode;

}


In UI-Designer however is the required ListID not available by default:

So how can a ByD studio developer deal with context dependant codelist?

Best regards,

Ralf

View Entire Topic
ThomasSchneider
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ralf,

you need the contxt of the GDT in the BO: 

import AP.Common.GDT as apCommonGDT;

businessobject CodeListMapping_Test { 

   element CountryCode : CountryCode;

   element CustomerWorkAgreementAdministrativeCategoryCode :
                WorkAgreementAdministrativeCategoryCode;

}

As a next step, go to the UI designer, select the data element CustomerWorkAgreementAdministrativeCategoryCode.content, and select "Codelist Context Mapping" from the context menu. You can maintain the context of the structured code as shown in the following figure:

Save and activate the UI model. The result is as follows:

If you set the CountryCode field (via UI or via coding) the Customer....Code code list is filterted by the country code. You can also set the Customer....Code.listID in ABSL code if the element is filled via code.

DavidRSG
Explorer
0 Kudos

Hi

I have a similar problem, but for units of measure (UoM). I don't know what and how to apply the context to the Quantity field so that it only shows me the sales units available for the product as shown in the sales order. Do you have any suggestions?

Greetings!