Talend Multiple Lookups - mysql

I'm starting to learn Talend and I'm facing this problem: I have several ID's as an input and I want to make a lookup for each of these ID's to output the obtain data in a Json output.
Here's an image showing what I want to achieve:
http://i.stack.imgur.com/GLVLf.png
I have a tXMLMap with a lookup to the table where I want to find the villains from the villainID's list. The image shows how I can get the ID and Name for one of the villainID's and output it in it's respective json field but this method only works for one ID lookup at a time.
What's the best way to achieve this?
Thanks!

You should be able to copy your second input table 8 times and link all of those back into the tXMLMap component and link those by key as you already have done and join those up to where it needs to go in the XML mapping.
Alternatively you could use a tMap component in a previous step and use that to generate waveNvillainN's dispName by joining the id of your lookup table to all of the waveNvillainN's ids. This should then leave you with all of the necessary fields to populate the XML mapping.

This is the way I could find out to solve this issue, I think it's the same that #garpitmzn and #ydaetskcoR meant but I'm not sure. This works perfectly and was easy to implement but I'd just hope there was a way to have less clutter of components.
http://i.stack.imgur.com/x3AHM.png
http://i.stack.imgur.com/PBeZn.png

Related

Saving a watchlist for each user in laravel

In the laravel project I'm currently working on I want to store watchlists of contents for each user.
I'm wondering now what is the best way to do it, I came up with adding a column to the users table named watchlist and then store a json string in there containing all contents on the watchlist of that user.
But I feel like this is the most simple and basic way to do it. Is there any better/ more elegant way to do it? FYI: I use mysql.
if the list items comes from another columns, i prefer to put the user watchlist in table instead of putting in on a json, because of cascading or any future update.

How should i save value of textbox in database as 1,2,3,etc format in laravel

I want to insert a value of textbox in the database and save it in the column joiner_id.
When I execute same form and add next value textbox.
Value is saved in same field in, separated format of same column in same id of table like 1,2,3...
If I understand it correctly, you want to make use of a relation between two tables. This means that one value gets stored in a 'description' table which has its own ID, and that ID is stored in your joiner_id.
If this is the case I would try to read the Laravel documentation about relationships, which will explain how you can setup a relation and get that specific text-value by id. Laravel Documentation about Relationships
I think you need to be more explicit about what you want to achieve. I'm not sure if I get this right, but what I think you want, it's a simple iteration for your joiner_id.
If so, you can achieve this using {{$loop->iteration}} as value for your joiner_id.
More information about it here: https://laravel.com/docs/5.8/blade#loops
If I get it correctly maybe you want to join two table with one to many relationship you should use bridge table instead of saving it in a same table.

postgres json output for 1:n tables

So I have a problem I can't seem to figure out. I have to make a fuction(in postgres, also called a stored procedure). The function has to check if a given id is a certain 'thing' for example:
Given id 10, is has the check if the id is a human(another table) or a animal(another table). If it is one of the two, it has to get all the attributes of that tabel. This repsonse has to be json formatted so that the application builder can build an extjs application around it.
So can someone give a push in the right direction, do I need to have a json out parameter? or a character varying? How do I give something back based on whenever the table exists or not. I hope someone can give me a push. Much appreciated!

LINQ to Entity Cross Tab

Is it possible with LINQ to do a cross tab query to add new columns? These columns come from a second and third table and need to be converted to JSON to be displayed in a Telerik table.
One table contains the name of the columns that need to be displayed and the other contains the value for the rows of each column, and this relates to the first table, which has the main related data.
I have investigated dynamically creating the extra columns, but also come unstuck as they need to go through JSON serialization, as well as the difficulties of creating new properties within any class dynamically.
Any ideas would be helpful.
Regards
Mark
I hope this helps, although I'm not sure I understand completely what you're asking ...
Since you're serializing to JSON anyway (and so presumably are not overly concerned with schema/type info), I would suggest just using a Dictionary and populating your data that way. It sounds like you could run some kind of nested loop, cycling through the column names from the one table, and pulling the values from each column from the second table.
EDIT
BTW, it is possible to do dynamic properties using System.ComponentModel, although this seems like overkill from how you described your scenario (you don't require data binding, for instance). Here's a good post on SO, if you're interested: Data binding dynamic data

Extract Distinct Record in SSIS

I am writing the SSIS package to import the data from *.csv files to the SQL 2008 DB. The problem is that one of the file contains the duplicate records in the csv file and I want to extract only the distinct values from that source. Please see the image below.
Unfortunately, the generated files are not under my control and it is owned by the third party and I could not change the way they generated.
I did use the LookUp Component. But it only checks the existing data against the incoming data. It does not check the duplicate records in the incoming data.
I believe the sort component gives an option to remove duplicate rows.
Depends on how serious you want to get about the duplicates. Do you need a record of what was duplicated or is it enough to just get rid of them? Sort component will get rid of dups on the sort field. However, the dups may have different data in the other fields and then you want a differnt strategy. Usually I load all to staging tables and clean up from there. I send the dupes removed to an exception table (we have to answer a lot of questions from our customers about why things don't match what they sent) and I often use a set of business rules (and use either an execute SQl or data flow tasks to enforce the rules) to determine which one to pick if there are duplicates in one area but not another (say two business addresses when we can only store 1). I also make sure the client is aware of how we determine which of the two to pick.
Use SORT tool for that from Toolbox, then click on it. You will get all available input columns.
Check the column and change sortType direction and then check "remove rows with duplicate sort value".
Bring in the data from the csv file the way it is, then dedup it after it's loaded.
It'll be easier to debug, too.
I used Aggregate Component and Group By both QualificationID and UnitID. If you want, you can also use Sort Component too. Perhaps, my information might help others.