› Clovertech Forums › Cloverleaf › substring failing
What version of Cloverleaf? What error are you receiving?
- Jared Parish
Could this be your issue? Archive KB 1550447
- Jared Parish
Since I’m not using string length, I don’t think so, but you did make me think of something. The value I’m trying to get in PID.13.6 is phone number in the format of 1234567. Could that be the issue, and if so, What do I use to parse just the first three digits?
Thanks,
-> Rich
You could just use 0 and 2 (I think that function is zero based if not then 1 and 3).
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Jim,
I’ve tried 0 2 and 1 3
Both fail in the exact same way. The odd thing is that I’ve got other xlates using the same function in the same way that do not fail. I’ve also tried removing the line, and recreating it. I’m befuddled! The only difference is that I’m dealing with numeric values instead of alpha characters.
So is the input a field with components or subcomponents?
Eg |^123456| or |&123456| or the like?
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Jim,
I’m parsing PH^^^601^1234567|
into (601)123-4567
So, component level only.
So should the component value in the Source be [4] and not [6]?
If you echo out the Source value as it is what do you get?
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
How do I echo out the value?
Thanks!
Refer to David Perry’s post below to echo out the value. But I think you have the incorrect value in the component notation.
My theory is the temp variable which is the target is being created in this Action (it did not exist before this Action). You are pointing to a non-existent input value by using the incorrect component value so the STRING Action does not populate the temp variable at all.
I think then the CONCAT has issues with the non existent temp variable.
To prove the point before adjusting the component value, you could add a COPY Action copying @null to the temp variable (@AD??) at the beginning of your Xlate. That will establish the existence of the temp variable so if the STRING Action does nothing the CONCAT will still find the temp variable (which has a value of null).
Of course, I could be way off base on that, but I am fairly sure you don’t have the correct value in the component notation.
To validate what it should be, run the input message through the HL/7 tester for your variant with the ‘noise’ level turned up so you can see hat the value should be in the address path for that component. The value shown there is what you should use in your Xlate.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
If I
copy 0(0).PID(0).#13(0).[5] to @AC
then copy 0(0).PID(0).#13(0).[6] to @AD then
Concat: =(
@AC
=)
@AD
I get (601)551XXXX – redacted number
so I know the segment is correct. However, as soon as I try to
xlateStrSubstring 0 2 with an input of @AD and output to @AE it fails.
All I can conclude is that we have a failure trying to substring a numeric value. I even tried putting @null in both @AE and @AF to make sure it had a value. The message still fails to send. Unfortunately, my testing tool is acting up and I’m unable to echo out values.
Thoughts?
OK if echo is not working, another trick is you can find unused fields in the OB message and COPY data items (IB or temp variables) you want to know the values of to those fields. Then those unused fields will contain the values.
If that does not shed any light and you have exhausted the various options for resolution perhaps contacting support is in order.
I don’t have access to Cloverleaf so unfortunately I cannot try to duplicate what you have.
Maybe someone who has the same release you are on may be willing to try to duplicate your effort.
If you think it would help, feel free to email me and I will try to work directly with you so I can look over your shoulder at your system.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Have you tried replacing end-4 with a fixed number just to see if that gets past the issue?
Is this happening in the testing tool?
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Jim,
I’m using this xlate to reformat the phone number as (999)999-9999. In the testing tool, it just leave the field that should be populated by my concatenate as a blank. I’ve tried putting constants in the variables in my concatenate, and see that that part is working fine.
Add this to the PreProc and let us know the output:
echo “inVals: $xlateInVals”
echo “inTypes: $xlateInTypes”
Simplify to one xlate action:
copy In: PID.13.5 and PID.13.6 Out: PID.13
lassign $xlateInVals pre post
set pre ($pre)
set post [string range $post 0 2]-[string range $post 3 end]
set xlateOutVals
Rich,
So did you ever get this resolved? Is this a bug with numerics?
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.