Good Day Devs,
I think there is an issue with the CHARS_FROM_LEFT function but it could just be me.
I am looking at some time selections in the format of {hour} space {AMPM} EX: 11 AM, 12 PM, 1 PM, 2 PM
I then convert that to a string formatted like 11:00, 12:00, 13:00, 14:00 etc.
All the selections work with the exception of the 1 PM selection.
I have been trying to figure it out for several, no many hours.
Any assistance would be appreciated.
I will upload a sample BSV of the issue but here is my Rule code.
Any assistance is much appreciated.
---------------------------------
If CHARS_FROM_RIGHT(tempBO.TimeChoice,2)='AM' AND CHARS_FROM_LEFT(tempBO.TimeChoice,2)<'10' Then
tempBO.Result=CHARS_FROM_LEFT(tempBO.TimeChoice,1)+':00'
Else If CHARS_FROM_RIGHT(tempBO.TimeChoice,2)='AM' AND CHARS_FROM_LEFT(tempBO.TimeChoice,2)>='10' Then
tempBO.Result=CHARS_FROM_LEFT(tempBO.TimeChoice,2)+':00'
Else If CHARS_FROM_RIGHT(tempBO.TimeChoice,2)='PM' AND CHARS_FROM_LEFT(tempBO.TimeChoice,2)='12' Then
tempBO.Result=CHARS_FROM_LEFT(tempBO.TimeChoice,2)+':00'
Else
tempBO.Result=CHARS_FROM_LEFT(AS_STRING(AS_NUMBER(CHARS_FROM_LEFT(tempBO.TimeChoice,1))+12),2)+':00'
CHARS_FROM_LEFT issue?
Re: CHARS_FROM_LEFT issue?
Not sure why my BSV didn't upload previously when I posted my issue but here it is again.
- Attachments
-
- CHARS_LEFT.zip
- (37.38 KiB) Downloaded 530 times
Re: CHARS_FROM_LEFT issue?
Instead of having a single rule that tries to cater to all possibilities , break down the IF statement into AM and PM
So
Rule 1 - AM
Rule 2 - PM
So
Rule 1 - AM
Rule 2 - PM
- Attachments
-
- CHARS_LEFT1.zip
- (37.67 KiB) Downloaded 507 times
Avid Linux user....
Re: CHARS_FROM_LEFT issue?
I second that. Having more than 3 'ELSE IF' statements seems not to work most of the time.. Separating into a few processes/rules that will do the same thing is much more reliable.
Re: CHARS_FROM_LEFT issue?
I will give your suggestions a go.
Thank you all so much!
Thank you all so much!