infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
Iteration issue.
Roy Osumi
Hey Folks -
I am on RedHat Linux 4.0 running CL 5.5.
I have a repeating field that has 1 field with 3 components. Each doctor can have numerous different doctor numbers with a unique ID. The problem is that there is no unique delimiter between each set of doctor numbers.
ex) 10^name1^IDa~11^name1^IDb~12^name1^IDc~20^name2^IDa~22^name2^IDc~23^name2^IDd~30^name3^IDa~31^name3^IDb~32^name3^IDc~33^name3^IDd~34^name3^IDe
name1, name2 and name3 are three different doctors. Name1 has 3 doctor numbers, Name2 has 3 doctor numbers and Name3 has 5 doctor numbers.
I want to pull out one doctor number per doctor based on this logic:
copy the number ,name and ID if ID = IDe
if no IDe then not copy number, name and ID if ID = IDc
if no IDc then copy number , name and ID = IDa
So output for the above example should look like this:
OBR#28(0).[0] = 10
OBR#28(0).[1] = name1
OBR#28(0).[2] = IDa
OBR#28(1).[0] = 22
OBR#28(1).[1] = name2
OBR#28(1).[2] = IDc
OBR#28(2).[0] = 34
OBR#28(2).[1] = name3
OBR#28(2).[2] = IDe
Any and all help is greatly appreciated.
Find more posts tagged with
Clovertech
Comments
RobertKersemakers
Hi Roy,
This can be a bit complicated, as it uses different 'techniques'. It also assumes that the name of these doctors is unique, or else you will have weird results.
I would do something like this:
* Initialize a list (like COPY
@null
->
@doctorlist)
* Use field-iteration to iterate over all the occurrences of the field. You will need to use %fnn (so %f1) as a variable and the basis will be the field with the repetitions.
* Inside the iteration, loop through (or better: search)
@doctorlist
for the name of the 'current' doctor. If it's not in the
@doctorlist
, then append name, number and ID as a list into
@doctorlist
. If the name is already in the list, check the corresponding ID and, if necessary, replace the found list with this (new) name, number and ID.
(So
@doctorlist
will be a list of lists; sounds complicated, but just put in a few echoes and you will see what you are doing)
* At the end of the loop, you have a list with all the correct names+number+ID. Now you will need to put these values into OBR-28. Follow this link
Single Field multiple components to create new segments.
for an explanation on how to iterate over a dynamic list (in this case your
@doctorlist)
.
Hope this helps. If not: just ask where you need some more directions.
Roy Osumi
Thanks for your help. I will try and work this on this fix. Is there a way use the ID called IDa this is always the first ID and all doctors have one?