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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tmap, lookup, insert new rows

Hello again!
i´ve got the following two tables like:
table1)
Coinfind:
id Issuer Name
360 3 Aedui
366 34 Augustus
128 4 Aedui
... ... ...

table2)
Issuer:
id Name
1 Augustus
2 Tiberius
4 Julius
5 Aedui
.. ...
33 Augustus

table1 mysqlinput --------> tmap --------------> tlogrow (should be: result table, mysqloutput)
^
|
|
table2 (lookup) mysqlinput

so.. the issue ist, that i´ve got some same strings in both tables and also some names in table1, which are not included in table2.
so, first of all i want to do a lookup from table2 to table1 if you can find ids an names of table1 in table2. this i would like to do with string equal.
Issuer and id means the same (FYI).

1) if table1.Name.equals(table2.Name) && table1.Issuer == table2.id >> do nothing
2) if table1.Name.equals(table2.Name) && table1.Issuer != table2.id >> id of table 1 should get that id of table2
3) if you can´t find table1.Name in table2.Name, insert Name of table1 to table2 and set a new id for it.
i had duplicate names in table2 and i solved it with tuniqrow. ok. done.
but now i´m trying to use tmap with little successes, but actually i don´t really know how to use it the right way.
on the left hand, i´ve got my two tables, table1 and table2 and on the right, i´ve got my result table with the same attributes like in table1.
i dragged and dropped the columns of table1 to the result table: id ----> id, Issuer -----> Issuer, etc.
i dragged and dropped the columns of table2 to the result table: id ----> Issuer, Name -----> Name
in the tmapsettings on the right: catch lookup inner join is true, catch output is false.
in the expression field on the right side below the schema type i want to put in the points 1), 2), 3) like above, but i don´t know how to express to set new ids and do nothing.
another point is: should i drag and drop the Issuer and all other columns from table1 to table2?
pls help.. tmap does something, but i need the expressions.
thanks for helping me!
Nadine
Labels (2)
30 Replies
Anonymous
Not applicable
Author

thank you for your help.
now, first i will go on with the tutorials or "i have to", because i just read them.. 0683p000009MA9p.png you´re right. maybe then i will come back!
have a nice day!
nadine
Anonymous
Not applicable
Author

it´s partly working now.
but i still have some trouble, pls have a look at the screenshots.
i want to set new id´s to picture one. i. g. 7 to 6 and so on (the last picture is the lookup table, Name Aedui with id6, for comparison only. "Issuer" of the 1st picture corresponds to "id" of the last picture)
the second picture is the corresponding tmap. you can see the output in picture 3.
if i do the lookup on name2.. the upcoming picture 5 shows me that the join failed - again (the corresponding tmap in picture 4)
you can find all the names (name1 AND name2) included in the lookup table.. the join couldn´t fail in fact.
i´m at a loss now. i cannot understand why it´s working on name1 and why it won´t work on name2?
alevy
Specialist
Specialist

Looking at picture 5, I think you'll find the problem is trailing spaces in your source but not in your lookup. Unless you have good reason, I always recommend changing the advanced setting of each input component to "Trim all columns" to avoid this.
Anonymous
Not applicable
Author

it´s all working now! made my day.
Anonymous
Not applicable
Author

hi everybody,
i want to filter only those record which was stored yesteday can someone please tell me How can i fetch that records using Created date field?
thank you,
Regards ,
Sam
0683p000009MCXJ.png
Anonymous
Not applicable
Author

can you provide more details like. what is source, where do you want to use filter so on. 
but if it is database or file then there is opportunity to filter data base on date. 
you can use TalendDate.getDate()-1  function which will return you yesterdays date. then use this date for filter. 
Anonymous
Not applicable
Author

hi Everybody,
i have fetched two modules from salesforce and have to join and extract data which uploaded last day
can u please tell me which condition may i used for it?
0683p000009MCaq.png
Anonymous
Not applicable
Author

you can use below code in tmap at right side Expression filter field. 
TalendDate.getCurrentDate().after(TalendDate.addDate(TalendDate.getCurrentDate(), -1, "DD"))

in above case use row2.CreatedDate for filter. 
TalendDate.getCurrentDate().after(row2.CreatedDate.addDate(TalendDate.getCurrentDate(), -1, "DD"))
Anonymous
Not applicable
Author

hi Umesh sir,
As you sugest i have used the Expression 
TalendDate.getCurrentDate().after(TalendDate.addDate(TalendDate.getCurrentDate(), -1, "DD"))
in Filtered_Data table but it gives the error Quote cannot be resolved to a variable
tell me the problem
tahnk you.
Anonymous
Not applicable
Author

can you show me tMap screen shot and the error code