Days of Week field type value how to get it displayed in portal

Karthick Nagara
Tera Expert

Hi All,

 

We have a custom table with a field u_day_of_week of type Day of Week 

KarthickNagara_0-1668030597016.png

Selecting the days stores the value as 1234567 as a string (in the above case the value is stored as 12)

 

In list view it shows as Mon Tue

KarthickNagara_1-1668030718188.png

 

How to retrieve and print this value as it shows in list view (getDisplayvalue is not working as it also returns the value as "12")

 

In EC portal (we have a widget to display the list of custom table records) also the value is displayed as "12",

KarthickNagara_2-1668030860235.png

Is there any way to get this displayed as "Mon Tue." in portal

 

 

 

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, I don’t believe that there are ‘displayValues’ and the detail you see in the list view are calculated specifically in the UI by SNC (somewhere), it is never a good idea to leverage undocumented functionality - like 'day_of_week' data type.

 

A simple solution would be an additional string field that you would update\set with BR or client script based on changes to the day_of_week field, perhaps something like

 

var myDays = '1 2 6'; //for testing

var myResult = [];
var myReference = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
var mySource = myDays.split(' ');

for (var days in mySource) {
myResult.push(myReference[mySource[days] -1]);
}

gs.info(myResult.toString())