Shared String - Editing - Help

Printed From: Crystal Reports Book — Forum Name: Technical Questions

I have a report that is using this formula currently.

shared stringvar cpt;

if not isnull({Authorization_ProcedureData.Code}) and {Authorization_ProcedureData.Code} <> '' Then
    if instr(cpt , ',' + {Authorization_ProcedureData.Code})=0 then
        cpt := cpt + ',' + {Authorization_ProcedureData.Code};

''

*****
I want to now see if it is possible to be able to add something to this report, to do this:

If {Authorization_ProcedureData.Code} in ['550','551','552','559','580','581','582','589']
Then 'G0300'
Else
If {Authorization_ProcedureData.Code} in ['420','421','422','424','429']
Then 'G0151'
Else
If {Authorization_ProcedureData.Code} in ['430','431','432','434','439']
Then 'G0152'
Else
If {Authorization_ProcedureData.Code} in ['441','442','444','449']
Then 'G0153'
Else
If {Authorization_ProcedureData.Code} in ['570','571','572','579']
Then 'G0156'
Else
If {Authorization_ProcedureData.Code} in ['560','561','562','569']
Then 'G0155'

******
Can this be done and if so how?

TIA

It's not clear where you want to add this. Is this a value to add this. Is this a value to add to the existing formula?

-Dell
I would like to add it to the existing formula(s) if that is where it will work.

The report is working off quite a few formulas that are related to the CPT Codes and I am not sure how to now add that when the report pulls in a CPT code of one of these CPT codes being used;
'550','551','552','559','580','581','582','589'

I want it to change that to G0300 every time.

The multiple formulas already on the report, I am not familiar with them and they are below, if that helps at all.

Formula is called: AllCPT and does this:
shared stringvar cpt;
mid(cpt,2)

Formula is called: AllCPTDescp and does this
shared stringvar cptdesc;
mid(cptdesc,2);

I just don't know how those formulas work and how to add my new need or where to add it in the report.

Thank you if any of this makes help and sense.

Hi,

The first formula that you referenced, is creating a unique string of codes.

If I understand what you are asking, you want to replace the those codes with a different identifier.

If so, I would do something like this:
local stringvar code:={Authorization_ProcedureData.Code};

insert your if statement here, instead of then 'G0300' replace it with THEN code := 'G0300'

then in the original code, replace {Authorization_ProcedureData.Code} with code. This will build a string of unique codes but will substitute your code for the existing codes

Hopefully this is clearer than mud.

Howdy lockwelle

Everything you explained was crystal clear up until the end.

When you explain to then go back to the original code, replace {Authorization_ProcedureData.Code} with code. Do you mean with the new code I created.

What I did was created new formula as you explained as CPT1 and did this:
local stringvar code:={Authorization_ProcedureData.Code};

If {Authorization_ProcedureData.Code} like ['550','551','552','559','580','581','582','589']
Then 'G0300'
Else
{Authorization_ProcedureData.Code}

Are you saying to now take that new formula CPT1 and put it in the original CPT code formula that has this:

shared stringvar cpt1;

if not isnull({Authorization_ProcedureData.Code}) and {Authorization_ProcedureData.Code} <> '' Then
    if instr(cpt1 , ',' + {Authorization_ProcedureData.Code})=0 then
        cpt1 := cpt1 + ',' + {Authorization_ProcedureData.Code};

''

Hi,

this is what I meant:

local stringvar code:={Authorization_ProcedureData.Code};

If {Authorization_ProcedureData.Code} like ['550','551','552','559','580','581','582','589']
Then code:='G0300'
Else
code:={Authorization_ProcedureData.Code}

Are you saying to now take that new formula CPT1 and put it in the original CPT code formula that has this:

shared stringvar cpt1;

if not isnull(code) and code <> '' Then
    if instr(cpt1 , ',' + code)=0 then
        cpt1 := cpt1 + ',' + code;


simply replace the field Authorization_ProcedureData.Code with the variable we just created called 'code'

HTH