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

if mit like Bedingung im Load Statement

Hallo Zusammen,

ich hätte mal wieder eine Frage an Euch.
Und zwar möchte ich im Load-Script ein If mit einer Bedingung, welche nur die ersten zwei Buchstaben eines Wortes anschaut, einbauen.

Dazu ein Beispiel:

TeilMengeDatum
A123101.1.18
A234201.2.18
B345501.2.18
B342101.3.18

Ich habe eine Tabelle mit drei Feldern, unter anderem dem Feld Teil, wozu ich aber ein weiteres Feld einbauen will, welches diese in ihre Gruppen unterteilt. Also alle welche mit 'A' Beginnen sollen in die 'Gruppe1' und die mit 'B' in 'Gruppe2', der Rest soll in 'Sonstiges'.

Versucht habe ich es mit folgendem vorangehendem Load:

Teile:

LOAD *,

if(wildmatch(Teil, 'A*'), 'Gruppe1',

  if(WildMatch(Teil, 'B*'), Gruppe2','Sonstiges')) as Gruppe;

LOAD

     Teil,

     Menge,

     Datum

From .....;

Aber leider hängt er sich an diesen Zeilen immer auf, ohne Fehlermeldung.

Ich wäre euch sehr dankbar über Hinweise oder Hilfe.

Grüße
Merry

1 Solution

Accepted Solutions
merry2018
Creator III
Creator III
Author

So I put that if statement in the main load and not a previous one, and it works.


Thanks!

View solution in original post

6 Replies
tresesco
MVP
MVP

May be a single quote issue correction helps.

Try like

  1. LOAD 
  2.     Part, 
  3.     Amount, 
  4.     date,
  5. if (wildmatch (part, 'A *'), 'group1', 
  6.   if (WildMatch (part, 'B *'), 'group2',' other ')) as group
  7. From .....;
merry2018
Creator III
Creator III
Author

Thanks for that notiz, but maybe I vergott it here. In my Script is it correct.

Must be an other mistake in there.

tresesco
MVP
MVP

Does it load smoothly without this wildmatch() statement? How long does it take?

merry2018
Creator III
Creator III
Author

Without that Load part [with the if(wildmatch())] it take lesser than a Minute, and with that it take so Long, till I stopp it hard.

merry2018
Creator III
Creator III
Author

Maybe it is an other mistake, because a normal if condition doesn't work as well.

merry2018
Creator III
Creator III
Author

So I put that if statement in the main load and not a previous one, and it works.


Thanks!