Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

creating a template


Hi all,

I have a database from which i am trying to retrieve data  and create a template. the template has the following structure.

IDdescription value
1number of people in brazil1200
1.1number of women in brazil800
1.2number of men in brazil400
2number of cars in brazil09807

to create this template I have written the following piece of code.

tblDetails:

load *inline [

ID, desciption

1, number of people

1.1, number of women in brazil

1.2, number if men in brazil

2, number of cars in brazil

];

tblTemplate:

load

'1' as ID,

[date if entry],

count(people) as value

resident tblMaster

where country ='BRAZIL'

group by [date of entry]

;

concatenate load

'1.1' as ID,

[date of entry],

count(people) as value

where tblMaster

where country='BRAZIL' and gender='female'

group by [date of entry]

;

ETC.

this works fine until a certain ID has zero records because of its conditions (this cause the row to disappear from the straight table). My requirement is to display the row (as the template needs to be of a fixed format) and insert the value column as zero.

Does any one know how i can do this?

Cheers,

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Add the end of the script you can load a set of default records for the missing id's

concatenate load * inline [

ID, description, value

1, number of people in brazil, 0

1.1, number of women in brazil, 0

1.2, number of men in brazil, 0

2, number of cars in brazil, 0

3, number of something in brazil, 0

3.1, number of something else in brazil, 0

....etc

]

where not exists(ID);

This way only the records of the missing ID's will get loaded from the inline load.


talk is cheap, supply exceeds demand
Not applicable
Author

hi,

thanks for the help. i can see the logic behind it however it doesnt seem to work and i am not sure why.

I have amended the original message. maybe the additional code i included helps explain why it doesnt work?

cheers