Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Check two field values for same entry

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 CodeSecondary Medical CodeChief Complaint
111
121,2
11
11


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

2 Replies
Not applicable
Author

Hi Phil,

take a glance into the script of my little exam app.

Regards, Roland

isaiah82
Creator III
Creator III

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] )))