I’ve come across the same situation twice, so time to blog about it. I have an EDI segment that can take 4 line procedure codes. The back end system contains the 4 procedure codes, but it is not guaranteed which order they will be populated or if they will be populated at all. For example procedure code 1 could be NULL but 2, 3, and 4 could be present. The EDI segment requires that procedure codes be populated starting at element 1.

I created an incline C# that would accommodate this scenario. Throw all your procedure modifiers into the scripting functoid and adjust the int_ProcedureModifierToReturn to the one you’re needing and away you go.

public string get_2400_SV101_2(string LINE_PROC_MODIFIER1, string LINE_PROC_MODIFIER2, string LINE_PROC_MODIFIER3, string LINE_PROC_MODIFIER4)
{
int int_ProcedureModifierToReturn = 0;
//All Data will be in the form of example: BH*A2*20041201^BI*A2*20041201-20041215
string[] arry_ProcedureModifiers;
string str_ProdedureModifiers = LINE_PROC_MODIFIER1 + “^” + LINE_PROC_MODIFIER2 + “^” + LINE_PROC_MODIFIER3 + “^” + LINE_PROC_MODIFIER4;
//Split the LINE_PROC_MODFIERS into an array
arry_ProcedureModifiers = str_ProdedureModifiers.Split(‘^’);
//Sort the Array to get like Qualifiers together
System.Array.Sort(arry_ProcedureModifiers);
//Reverse the array order to get the blank records to the end
System.Array.Reverse(arry_ProcedureModifiers);
//Return the element if it exists
if (arry_ProcedureModifiers[int_ProcedureModifierToReturn].Length > 0)
{
return arry_ProcedureModifiers[int_ProcedureModifierToReturn];
}
else
{
return “”;
}
}