Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Staff
Posts: 40
Registered: ‎02-27-2018
Accepted Solution

GMSC Workflow: use DECODE in a List

I habe a workflow in GMSC (16.3)  and I want to change the display of an attribute from 1 and 0 to Yes and No.

Indeed, in my db-table in oracle, we saved the data with 1 for yes and 0 for no, but for the user, it would be best to show Yes and No.

 

I want to show this in the list and tried the following:

  • persisted field with data from the DB (AVAILABILITY) and showing 1 and 0
  • non persisted field with DECODE to change the 1 and 0 into Yes and No.
<FormField name="AVAILABILITY" label="Available:" type="textfield" 
datatype="number" required="false" visible="list" maxlength="22" />

<FormField name="AVAILABILITY2" label="Available:" type="textfield" 
datatype="string" required="false" visible="list" maxlength="22" persisted="false" 
sqlselect="SQL[DECODE({FORM.AVAILABILITY},1, 'Yes','No')]"/>

 But so far, I only get No everywhere. It seems like the 1 are not being evaluated properly

 

What I am doing wrong? Any alternative I can use?

Highlighted
Contributor
Posts: 68
Registered: ‎11-12-2015

Re: GMSC Workflow: use DECODE in a List

I think you don't have to use two fields - it should work like this:

 

<FormField name="AVAILABILITY" label="Available:" type="textfield" 
datatype="number" required="false" visible="list" maxlength="22" 
sqlselect="SQL[DECODE(TABLE.AVAILABILITY,1, 'Yes','No')]"/>

 

Note that in List, you cannot use {FORM.AVAILABILITY}, but you need to use TABLE.AVAILABILITY, where TABLE is the same as defined in Form (<Form table="TABLE">)

Highlighted
Staff
Posts: 40
Registered: ‎02-27-2018

Re: GMSC Workflow: use DECODE in a List

Hi,

thanks for the input.

I switched to using only one field and when I saw that you were not using {} at all in your example (in the documentation they do use them), I simply tried:

 

SQL[DECODE(AVAILABILITY,1,'Yes',0,'No')]

and it worked!

 

It also works with the name of the table in front of it:

SQL[DECODE(TABLE.AVAILABILITY,1,'Yes',0,'No')]