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

Data when there is no data!

All,


I have an unusual scenario and hoped you might be able to provide some advice about how best to approach the problem.

I need to add a new tab to an existing QlikView document. The primary data source for this new tab is a
Questionnaire/Survey feedback database.

As the name suggests this database holds the responses to a number of survey questions. Around 100 in fact. There are three possible responses. Compliant, not applicable and Not Compliant.

For an individual respondent the database might hold 100 responses, or a partial set of responses, say 20, or no responses at all.

If a particular respondent has no responses, i.e. they haven't started the survey, the database will hold no records for the respondent. Not even a placeholder record. We know who the respondents should be because they form part of the dataset for rest of the QV document.

What I need to do here is to create some synthetic values for respondents who haven't yet started the survey or have only answered a few questions. Ideally all non answered questions should have a default value of 'Not compliant' as far as QV is concerned. P.S. I do not look after the survey database itself so cannot do anything to alter the existing design/schema/operating model.

My question is really about where to create any synthetic responses. At the SQL select level in the QV scripts or via 'If' statements in the QV script? Or by some other mechanism?

I would appreciate any example code especially for the 'If' statement scenario. For example would 'if Len(....' be better than 'if IsNull' or would a combination of the two be required? Should I be looking at the NullAsNull/NullAsValue functions?


Tom

3 Replies
Not applicable
Author

Hi Tom,

I created a short example using QV inline tables.

You have to figure out if "IsNull" as example will find the fields without an entry.

Maybe you are able to provide demo data to play around with.

Good luck!

Rainer

RicardoRamos
Employee
Employee

I'm sorry for not sending an example, i'll try to do it latter.

If you a table with all the people that should respond, and a table with the anwsers, i'd do this:

1 - Load the dimension first (people who should respond);

2 - Create a fact table based on the dimension (to have all the people there);

3 - Left join the anwsers table with the fact table created, that way you will have the people who gave answers with values and people who don't with nulls;

4 - Create a final table from the fact table where you replace the nulls with the text that bests suits you.

I hope that this helps you,

Ricardo

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Attached is another possible solution.

On question #2, I recommend always using len() instead of IsNull(). See
http://community.qlik.com/docs/DOC-1294

-Rob