cancel
Showing results for 
Search instead for 
Did you mean: 
Security Alert Log4j Security Vulnerability. Click here to know more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Varying Time Stamp Localization token based on User Extension

SaiPrakash
5-Regular Member

Varying Time Stamp Localization token based on User Extension

Hello,

 

I have a requirement where I need Vary the Timestamp (12hr/24hr) Format in the Localization Token (dateTimeFormat_Default) based on the User Extension. So that the End User (at the time of registering) will select his preferred time Format and the whole application where ever the timestamps are present will show up in the as per their preference.

Is this is possible. If Yes, how do we do it.

As of now I have a Idea of writing a service for each and every label or grid where timestamp is being shown. But, it is not Idealistic and a mundane task to do.  

 

10 REPLIES 10

Swapping between 12hr and 24hr format.

I've never been on a project that had this requirement.

If it is just labels, you could run the timestamp through an expression which either leaves it or converts it to the other format.

that doesn't capture data labels in a grid I think

It might do the actual infotable payload, but you may have to convert that server side.

SaiPrakash
5-Regular Member
(To:PaiChung)

Hi Pai,

Thanks for you Inputs.

 

I too thought so. But, we cannot check the User Extensions in the Expressions. So I had to go for a Service (which I am already Implementing.)

 

My ask is.. Is there any way to modify the localization Tokens of DateTime Format (Ex. dateTimeFormat_Default) in the run time based on User Extension? (I have created a User extension which saves stores the User Time Format Preference)

You get user extensions in the runtime from the User tab on the right side where there is Data/Session/User

SaiPrakash
5-Regular Member
(To:PaiChung)

That was Helpful... Pai.

 

But, There is still a pain of adding an Expression to each and every label (in my case aprox. 45 Labels) and however I have to go for the Service in case of Grid. 

And this is the reason I was asking if there is any possibility of Changing Localization Tokens at the Run time ?

It would be very helpful if you could let me know if it is possible or help me with a work around.

Yes you can do an edit to the token and then reload the tokens and reload the window.

There are services for all that in  the Localization table/Localization functions resource.

and then in the expression you can do a location.reload()

SaiPrakash
5-Regular Member
(To:PaiChung)

Also, I was not able to use the inbuilt Functions / Snippets like dateFormat() & date().get**** cannot be used in the expressions. 

So I tried taking DateTime Input in String format and manipulated the string according to my req. format. Not efficient though. Any Suggestions?

 

If the expression doesn't allow the use of that, then probably I would go with the set token / reload approach

SaiPrakash
5-Regular Member
(To:PaiChung)

Pai,

 

Can you please show me an example about how to set the Tokens. Unable  to do it.

 

Thanks in advance.

Localization tables have a service called: AddOrUpdateToken

Hello @SaiPrakash,

 

Another option would be to create two labels for each value (one with 12h format, another one with 24h), overlay them in the mashup and control their visibility via a simple validator. This solution is far from ideal, but at least avoids writing 45 expressions (you can use the same validator to show/hide all 12/24 labels at once).

 

A side remark -- if I had 45 labels on the same form I would seriously consider using a Grid or Collection instead of Labels.

 

/ Constantine

Announcements