Dynamic filter rows in Talend - talend

Is it possible to get values from a Excel file and use them to filter rows in Talend?
For example:
I have an Excel file with account numbers list.
In Talend, I have a query in a tDBInput linked to a tMap, that is linked to a tFilter. This filter is based on Excel columns values with the accounts list.
Or if I can use the account list in the where clause in tDBInput. The problem is that the account list can change anytime.
Thanks a lot.

There are multiple ways to proceed :
Link your tDBInput to tMap as the main flow, and your excelInput as the lookup. Make the join between the two flow in tMap as an inner join : this way you can filter main data with data coming from excel. The inconvenient is that you will read all data from DBInput and filter after that, which is less efficient.
You can also make it through two subjobs :
First subjob : tFileInputExcel -> tJavaRow . Push your list of accounts to a String in a context variable to construct your "where" query. (you can also use a tAggregateRow with 'list' mode to build a list )
Second subjob : use this constructed context variable as filter in your DBInput query. This way you'll read only valuable data in this component.

Related

How to relate a column to the row rather than the other way in anylogic

I have created a database in anylogic. Previously, I have related the information in the row to the columnn, i.e. there is a component in the row, and its properties are in the columns, and have put this in a function. Now I want to make the component the column and the properties, but don't know how to make it all relate. Below is the code I've written for the former:
site = selectFrom(parameters) .where(parameters.box_number.eq(boxNumber)) .where(parameters.site.eq(site)) .firstResult(parameters.site);
So box_number is the component and site is one of the properties. With this method, site is a column, but I want it to be a row.
You should use the SELECT WHERE SQL syntax, see https://help.anylogic.com/index.jsp?topic=%2Fcom.anylogic.help%2Fhtml%2Fconnectivity%2Fquerying.html&resultof=%22%73%65%6c%65%63%74%22%20%22%77%68%65%72%65%22%20
You can filter and load data in any format. Also, best use the database query wizard to help:

IF ELSE Function through different datas sources

I have two data sources in my Tableau Sheet and i want to create an if else function for true or false.
The two data sources have the same column Name which is Fahrzeug and and there are values in first data source that has the same Fahrzeug Value as the other data source, and i Need a if else function which will give me True if there are the same values in both data sources and False if its not the same.
This is how the Tableau sheet Looks like.
Examples of datasets :
First and the main dataset
Second dataset
Difficult to really know what will work best without knowing what intend to use that Boolean field for. Regardless, I find Tableau fairly poor for iterating through and comparing values in different tables, as that wasn't it's design. Best bet would be process than outside of Tableau, either Tableau Prep or write a script of some kind.
But one possibility using a pure Tableau desktop method would be to just create a new dataset that has a full outer join on the [Fahrzeug] field.
Create a new datasource using a the full outer join on [Fahrzueg] in FFE_Ausfalldaten.csv and FFE_Boxplot.csv
That gives you a null in the left dataset when it appears only in the right, and vice versa. With the same value in both [Fahrzeug] field's when it appears in both.
Then create a calculated field in the new datasource called [Fahrzeug_Bool] or whatever you want
iif((ISNULL([Fahrzeug1])=True or ISNULL([Fahrzeug2])),FALSE,TRUE)
this assigns False is either Fahrzeug field is null (i.e. only common in one file), True otherwise
Then edit the datasource relationships so the [Fahrzeug] fields in the individual fields (FFEAusfalldaten.csv and FFEBoxplots.csv) are linked to the corresponding [Fahrzeug1] and [Fahrzeug2] fields in the joined dataset.
Pull the individual fields into view along with the [Fahrzeug_Bool] field and validate they are True or False as expected

data merging in Tableau

I have two sheets in excel. One has CBG (neighborhood) IDs as shown below.
The second sheet has state and county names and IDs as shown below.
Now the first 5 digits in the CBG ID are just the corresponding state and county IDs for that CBG.
I need to to join this data together in Tableau so that I would have the state and county on the CBG sheet for each CBG.
Basically I tried to blend the data and it didn't work. I also tried to perform a join calculation using the 5-digit code in the second sheet and the LEFT function to extract the 5-digits in the CBG code but it didn't seem to work either.
To fix it, just needed to fix the Join calculation on both sides of the join.
Also, it seems that both variables to be joined need to be the same data type.
The data that you analyze in Tableau is often made up of a collection of tables that are related by specific fields (that is, columns). Joining is a method for combining the related data on those common fields. The result of combining data using a join is a virtual table that is typically extended horizontally by adding columns of data.
When joining tables, the fields that you join on must have the same data type. If you change the data type after you join the tables, the join will break.
Please go through the below steps for joining tables:
In Tableau Desktop: on the start page, under Connect, click a connector to connect to your data. This step creates the first connection in the Tableau data source.
In web authoring: Select New Workbook and connect to your data. This step creates the first connection in the Tableau data source.
Select the file, database, or schema, and then double-click or drag a table to the canvas.
Double-click or drag another table to the canvas, and then click the join relationship to add join clauses and select your join type.
Add one or more join clauses by selecting a field from one of the available tables used in the data source, a join operator, and a field from the added table. Inspect the join clause to make sure it reflects how you want to connect the tables.
When you are finished, close the Join dialog.
Thank you.

How to filter dashboard based on quick filter values selected in Tableau ?

I'm having Dashboard-1 with the data source from SQL Server Table-A having columns
Col1,Col2,Col3
Now, i'm creating a new dashboard-2 with data source as Table-B having columns Col1,Col4,Col5.
But Col1 which is common in both these tables doesn't have common data.
Eg. Col1 from Table-A is having records till 100 and Table-B is having records from 101.Also, the data is not static, its keeps on increasing in Table-B , Table-A is no longer populating but we need the data from it.
Problem1-- How to merge two column as single column for filter in Tableau
Problem2-- in the dashboard i need to show single filter as a union of Col1 from both tables, if user select value <100 then Dashboard-1 will open otherwise Dashboard-2.
Can someone provide me a correct approach.
1) Instead of merging after you have brought the data in, try merging the data using SQL UNION.
2) If that's not possible, do the same after importing both the datasets into Tableau. For an example, try from this official link
3) Try different Joins to see which one works for merging your table columns:
4) If all the above fails, try setting up an Action Filter explained in this link. Essentially you have to use Tiled Containers instead of Floating Containers and set up a action filter using a custom Parameter. This custom Parameter will help display Dashboard 1 when user selects <100 in the filter(for example) and Dashboard 2 when user selects >100(again example)

talend open studio create tmap

I want to select certain columns from 2 tables by coding the appropriate SQL code in the "query" zone of my tMySQLInput component. Then I've been told to use a "tMap" component in order to map each column from my tMySQLInput component to my tMySQLOutput component.
Is this the correct way to to do what I need to do : Take information (SELECT ...) from 2 tables and then insert them into another 3 rd table?
Inorder to insert data from 2 tables (source) into another table(target), it is necessary to use tmap component.
1.tMysqlinput(with query) and check the edit schema section for appropriate values you wish to send to the output/target
2.tMap component map all the necessary columns from source to target
3.tMysqlOutput check the edit schema section for appropriate columns that you wish to see in your target.