Question
IBM
IN
Last activity: 17 Feb 2021 10:20 EST
Auto formatting time as XX:XX
I have one requirement like when i enter the time as 1005 it should automatically format as 10:05. Can anyone explain how to implement this?
Thanks in Advance !!
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
IN
Hello @gubbas78,
I am just adding some more details to @Rachit_Agarwal reply.
I assume that you are taking input in text input field.
1) Open the property configured on the input field.
2) Go to advanced tab of the property and create own edit input as shown below
Hello @gubbas78,
I am just adding some more details to @Rachit_Agarwal reply.
I assume that you are taking input in text input field.
1) Open the property configured on the input field.
2) Go to advanced tab of the property and create own edit input as shown below
3) create a EditInput as shown below with code.
4) The code of edit input looks like
if(theValue.length()==4){
try{
Integer.parseInt(theValue);
theValue = theValue.substring(0,2)+":"+ theValue.substring(2,4);
}catch(NumberFormatException e){
//nothing
}
}
5) Once saved, Go back to configuration of the control and its action tab then configure, Referesh-This-Section as shown below.
6) Run the scenario.
Scenario 1 : (unsuccessful scenario)
Scenario 2 : (unsuccessful scenario)
Scenario 3 : (successful scenario)
Hope this helps !
Please feel free to post for any follow-up questions.
Thank you,
Regards, Cherb.
Pegasystems Inc.
US
You can use the below code in Edit Input Rule.
theValue = theValue.substring(0,2)+":"+ theValue.substring(2,4);
Please make sure we perform validation.
Accepted Solution
Pegasystems Inc.
IN
Hello @gubbas78,
I am just adding some more details to @Rachit_Agarwal reply.
I assume that you are taking input in text input field.
1) Open the property configured on the input field.
2) Go to advanced tab of the property and create own edit input as shown below
Hello @gubbas78,
I am just adding some more details to @Rachit_Agarwal reply.
I assume that you are taking input in text input field.
1) Open the property configured on the input field.
2) Go to advanced tab of the property and create own edit input as shown below
3) create a EditInput as shown below with code.
4) The code of edit input looks like
if(theValue.length()==4){
try{
Integer.parseInt(theValue);
theValue = theValue.substring(0,2)+":"+ theValue.substring(2,4);
}catch(NumberFormatException e){
//nothing
}
}
5) Once saved, Go back to configuration of the control and its action tab then configure, Referesh-This-Section as shown below.
6) Run the scenario.
Scenario 1 : (unsuccessful scenario)
Scenario 2 : (unsuccessful scenario)
Scenario 3 : (successful scenario)
Hope this helps !
Please feel free to post for any follow-up questions.
Thank you,
Regards, Cherb.
IBM
IN
Thank You. It worked for me.
Pegasystems Inc.
IN
I am glad that it worked for you. Request you to mark it as "Correct answer" to let the other developers to point to right answer when this post pop out in their search.
Pegasystems Inc.
IN
Hello,
We have marked this post as Answered.
Thank you.