Qlik Community

QlikView Administration

Discussion Board for collaboration on QlikView Management.

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
cancel
Showing results for 
Search instead for 
Did you mean: 
Der_Hausbauer
Contributor
Contributor

Befüllen einer Tabelle nur, wenn noch kein Wert da ist

Ich möchte am Ende eine 1:1 Befüllung aller Felder YNFIELD haben an dem Merkmal FallID.

 

Zunächst befülle ich ein paar Felder YNFIELD mit 'YES', bei denen eine Bedingung, die je FallID abprüfbar ist, erfüllt ist (Code ist A oder B oder F). Alle diese FallID bekommen ein YNFIELD mit 'YES'


Table2:
Load
'YES'
as YNFIELD,
FallID
RESIDENT TABLE1
where
Code = 'A' or
Code = 'B' or
Code = 'F'
;

 

Nun möchte ich aber weitere YNFIELD befüllen - aber nur noch die, wo noch kein YNFIELD pro FallID existiert.


Table2:
Load
'NO'
as YNFIELD,
FallID
RESIDENT TABLE1
where not Exists (YNFIELD)
;

Das funktioniert aber irgendwie nicht. Wie prüfe ich, ob so ein YNFIELD schon pro FallID existiert und schließe es von weiteren Bearbeitungen aus?

Vielen Dank für die Hilfe.

2 Replies
PrashantSangle

try below if it not work then share some sample data with expected output.

Noconcatenate
Table:
Load
'YES' as YNFIELD,
FallID
RESIDENT TABLE1
where
wildmatch(Code,'A','B','F')
;

concatenate
Load
if(not isnull(YNFIELD),'NO','YNFIELD') as YNFIELD,
FallID
RESIDENT TABLE1
where not Exists (YNFIELD)
;

Drop table TABLE1;

Regards,
Prashant Sangle
Great dreamer's dreams never fulfilled, they are always transcended.
Der_Hausbauer
Contributor
Contributor
Author

Dear Prashant, dear all,

that did not work well.

Here i have the source-table TABLE1:

FallIDCode
20G
20R
20L
20A
21X
21A
23Y
23V
23R
23N
23X
23P
24Z
24N
25A
25B
26A
27Z
28M

 

This  TABLE1 must not be altered. I Need it!

But a next table TABLE2 should exist with my new load scripts:

FallIDYNFIELD
20YES
21YES
23NO
24NO
25YES
26YES
27NO
28NO

 

Every FallID should only have one single Information - either yes or no.

So the "load" should walk through every FallID (Group by FallID) and decide wether Code is 'A' or 'B' or 'F' or it is not. So it writes the above black entries in the table?

And then the next "load" should fill the new table "Group By FallID" with the red missing entries - so that every FallID has exact one (not more, not less) YNFIELD

 

Please even help me with the ' signs - sometimes the second load did not work, because the YNFIELD was not like this:

where not Exists ('YNFIELD')

ERROR -Message "Field not found" in the second "load". When i wrote it with ', then it was found (but did not work well)

Thanks for help in advance

 

Bjoern