Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Luben
Creator
Creator

like and not like

hey am trying to wire below state in the load script 

load 

xyz,

From,

To

From Table_Name

where from Like ‘GB*’ or From Like ‘AB*’ And To Not like ‘GB*’ or ‘AB*’;

 

Does the above like correct any response is welcome 

Thanks

16 Replies
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @marcus_sommer , I think @Luben is talking about import/export of goods not fields 😉 From and To should be countries or regions, and he wants to know whats is travelling from AB* or GB* to other countries or regions.

Luben
Creator
Creator
Author

hello Marcus, my goal is to create directions for Import and export field based on the filtered fields based on

(from Like ‘GB*’ or From Like ‘AB*’) And (To Not like ‘GB*’ or or To Not like ‘AB*’);

 

Thank you for your assistance 

Lu

Luben
Creator
Creator
Author

thanks JG that’s is what i am trying to explain sorry for not been very clear with my explanation. 

Any Input is welcome 

thanks Guys

Lu

marcus_sommer

Maybe a change within the data-structure is more useful for your task, maybe something like this:

load Key, From as Value, 'Import' as Direction from Source;
load Key, To as Value, 'Export' as Direction from Source;

- Marcus

 

Luben
Creator
Creator
Author

IS it possible to write an IF statement 

IF(Like ‘GB*’ or From Like ‘AB*’) And (To Not like ‘GB*’ or or To Not like ‘AB*’) AS EXPORT

this is what i need help with getting wright thanks GUYS

marcus_sommer

Yes, it's quite the same like with the above mentioned flag - and instead of 0 or 1 you could return any available field or another manual value, maybe:

load *,
    if(WildMatch(From, 'GB*', 'AB*') AND Left(To, 2) <> Left(From, 2), From, null()) as Export
from x;

If there are multiple conditions on multiple values and/or fields it might be useful to prepare the fields in beforehand with something like left(FIELD, 2) to simplify the check and avoiding like's or wildmatch() and to be able to put the check-values into a mapping and returning the appropriate matchings per applymap().

- Marcus

 

Luben
Creator
Creator
Author

thanks Marcus..