Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
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.
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.
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
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()
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
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