Enumeration in webapps | Community
Skip to main content
Level 3
May 21, 2021
Solved

Enumeration in webapps

  • May 21, 2021
  • 1 reply
  • 3906 views

A webapp Page (v5 compatibility), Combo box input -> advanced settings Initialization: "Automatic via an enumeration" suggest we can use enumerations defined outside the webapp to populate a select element in our webpage's HTML.

 

Elements in schemas can use enumerations defined in the schema using attribute
enum="enumName"

 

Or, enum defined in different schema
enum="cus:schemaName:enumName"

 

Or, using a database enum
dbEnum="enumName"

 

However the settings for the combo box have a field "Enumeration Xpath", and however I write the reference to my enum, the select-element remains unpopulated.

 

The enum is of type system, and is working in inputforms using dbEnum="enumName" attribute. Can anyone share some light on how this is supposed to work, please?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by CedricRey

Hello,

I agree this is a bit confusing.... But if we give a look a little closer, with the builtin webapps (for example 'deliveryOverview', 'webAppOverview' etc. by filtering webApp with "XML memo (data) contains 'contextOptions useContext="2" '), the answer is : the xpath refer to an attribute of the document schema ("Document type" defined into the General properties of the webapp) that use a enumeration.

For example, if you choose "nms:delivery" for your webapp document type, you can put "@state" into the xpath to populate the options with the nms:delivery:deliveryState enumeration values.

It's not impossible that you could use webapp context enumeration maybe ? If I see something I'll give you more precisions.


Cedric

1 reply

CedricRey
CedricReyAccepted solution
Level 5
May 21, 2021

Hello,

I agree this is a bit confusing.... But if we give a look a little closer, with the builtin webapps (for example 'deliveryOverview', 'webAppOverview' etc. by filtering webApp with "XML memo (data) contains 'contextOptions useContext="2" '), the answer is : the xpath refer to an attribute of the document schema ("Document type" defined into the General properties of the webapp) that use a enumeration.

For example, if you choose "nms:delivery" for your webapp document type, you can put "@state" into the xpath to populate the options with the nms:delivery:deliveryState enumeration values.

It's not impossible that you could use webapp context enumeration maybe ? If I see something I'll give you more precisions.


Cedric

CedricRey
Level 5
May 21, 2021
Ok, I didn't noticed that if you need more flexibility, you can load custom values (for example into a script just before the page) and use the context 'ctx' to populate your list : choose the second options "from context" instead of "Automatic via an enumeration". Then you'll have to give the path of your xml list from the ctx (var ctx.mylist = <mylist><value myLabel="xxx" myValue="xxx"/><...></mylist>, just give "[mylist/value]" as options xpath, @myLabel for label xpath and @myValue for xpath value). By this way, you can load another enumeration from anywhere (schemas enums, xtk:enum etc.) to populate your input.