Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formula for multiple fields

Status
Not open for further replies.

MHPGuy

IS-IT--Management
Mar 14, 2002
143
US
I'm stumped on this one...

I have 25 text fields, all 5 characters long. The fields contain error codes for the row, so none, some, or all of the fields can be filled in.

What I'm trying to accomplish is to write a formula that translates all of the text fields into their english counterpart. It seems to be that I'd have to write 25 formulas to do this, but I'm looking for something simpler. I'd like to look at the 25 fields and have it output a list of the english translations into one field.

Any suggestions?

Michael Phipps
Technical Business Analyst
Mercy Health Plans
 
you should be able to do this with 1 formula

Code:
//@ErrorMessages
Stringvar array ErrorArray := [{field1},{field2},{field3} .......];
stringvar strError ;
numbervar i;

For i = 1 to ubound(ErrorArray)
DO (
If ErrorArray[i] = 'CODE1' Then
   if strError <> "" Then
      strError := strError + ", " + 'Code1 description"
   Else 
      strError := "Code1 description"
Else If ErrorArray[i] = 'CODE2' Then
   if strError <> "" Then
      strError := strError + ", " + 'Code2 description"
   Else 
      strError := "Code2 description"
...
...
...
Else If ErrorArray[i] = 'CODE25' Then
   if strError <> "" Then
      strError := strError + ", " + 'Code25 description"
   Else 
      strError := "Code25 description"
);

strError

perhaps not the most elegant of formulas but it should do the job.

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
I want to make sure that I'm getting this right...

each of the 25 text fields can have one of the error codes. The error codes are all the same, and can appear in any of the 25 fields. So, if the error codes and their decodes are:

V0100- invalid Void
00200- ineligible DOS
00300- invalid provider
...etc x about 200 codes

Then I would write this formula as you showed like this:

//@ErrorMessages
Stringvar array ErrorArray := [{clmr_txt.ERROR_CODE_1},{clmr_txt.ERROR_CODE_2},{clmr_txt.ERROR_CODE_3},{clmr_txt.ERROR_CODE_4},{clmr_txt.ERROR_CODE_5},{clmr_txt.ERROR_CODE_6},{clmr_txt.ERROR_CODE_7},{clmr_txt.ERROR_CODE_8},{clmr_txt.ERROR_CODE_9},{clmr_txt.ERROR_CODE_10},{clmr_txt.ERROR_CODE_11},{clmr_txt.ERROR_CODE_12},{clmr_txt.ERROR_CODE_13},{clmr_txt.ERROR_CODE_14},{clmr_txt.ERROR_CODE_15},{clmr_txt.ERROR_CODE_16},{clmr_txt.ERROR_CODE_17},{clmr_txt.ERROR_CODE_18},{clmr_txt.ERROR_CODE_19},{clmr_txt.ERROR_CODE_20},{clmr_txt.ERROR_CODE_21},{clmr_txt.ERROR_CODE_22},{clmr_txt.ERROR_CODE_23},{clmr_txt.ERROR_CODE_24},{clmr_txt.ERROR_CODE_25}];
stringvar strError ;
numbervar i;

For i = 1 to ubound(ErrorArray)
DO (
If ErrorArray = 'V01' Then
if strError <> "" Then
strError := strError + ", " + 'ICN Void Claim Not Found"
Else
strError := "ICN Void Claim Not Found"
Else If ErrorArray = '00200' Then
if strError <> "" Then
strError := strError + ", " + 'ineligible DOS"
Else
strError := "ineligible DOS"
...
...
...
Else If ErrorArray = '200v1' Then
if strError <> "" Then
strError := strError + ", " + 'failed recipient"
Else
strError := "failed recipient"
);

strError



Michael Phipps
Technical Business Analyst
Mercy Health Plans
 
Hi Michael

That looks right teh first part is to build the array of the 25 error fields, whilst the 2nd part of teh formula will build the error string.

If you want to have a multiline string then replace

strError := strError + ", " + 'ineligible DOS"

with

strError := strError + chr(10) + 'ineligible DOS"

remember to set the field to can grow.





Gary Parker
MIS Data Analyst
Manchester, England
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top