Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I have an SQL table which is loaded into a QVD file. Within the SQL table are two columns, Primary Medical Complaint and Secondary Medical Complaint. This data is based on an input from a handwritten form and often the two fields can contain the same data e.g. Primary code is 01, secondary code is 01. This means that when I map the code to a description I get the same description twice e.g. asthma asthma. What I would like to do is use some script that would analyst both fields, and if they are the same use the first one. If they are different then use both.
Its a bit complicated becuase the primary code can sometimes be blank as well. This might explaing things further with the chief complaint being what I would like the output to be.
Primary Medical Code | Secondary Medical Code | Chief Complaint |
1 | 1 | 1 |
1 | 2 | 1,2 |
1 | 1 | |
1 | 1 |
What is the scripting that I need to do this? I am struggling to do this with an If statement, is there something else I can use instead?
Many thanks
Hi Phil,
take a glance into the script of my little exam app.
Regards, Roland
Here's one option; probably not the cleanest:
if([Primary Medical Code] = [Secondary Medical Code], [Primary Medical Code],
if([Primary Medical Code='',[Secondary Medical Code],
if([Secondary Medical Code]='',[Primary Medical Code],
[Primary Medical Code] & ',' & [Secondary Medical Code] )))