how can i load two impala table which has one common field name and want to join them…
- User
how can i load two impala table which has one common field name and want to join them while loading it inot qvd
- Assistant
As an AI language model, I can provide you with general guidance on how to approach this task. However, I will need more details about the data and the tools you are using to provide a more specific solution.
Generally speaking, to load two Impala tables into a QVD and join them on a common field name, you can follow these steps:
-
Connect to Impala: Use a connector or driver to connect to your Impala database from your QlikView script.
-
Load the first table: Use the SQL SELECT statement to load the first table, specifying the common field name as a key field. For example:
LOAD key_field, field1, field2 FROM impala_table1;- Load the second table: Use the SQL SELECT statement to load the second table, again specifying the common field name as a key field. For example:
LOAD key_field, field3, field4 FROM impala_table2;- Join the tables: Use the JOIN statement to join the two tables on the common field name. For example:
-
- User
how can i load two \table which has one common field name and want to join them and there are two fileds in each table who's status should be done in qliksensewhile loading it inot qvd
- Assistant
To load two tables in Qlik Sense that have a common field name and join them while setting a particular field status, you can do the following:
- Load the first table: Create a load statement that extracts the data from the first table. Separate the common field name and the two fields whose status you want to set and use the mapping load to set the status of the fields. Here is an example of how to do that:
Table1: LOAD Common_Field_Name, Field1, Field2, if(Field1 = 'done', 1, 0) as Field1_Status, // Setting the status of Field1 as 'done' or 'not done' if(Field2 = 'done', 1, 0) as Field2_Status // Setting the status of Field2 as 'done' or 'not done' FROM Table1_FilePath;- Load the second table: Create a load statement that extracts the data from the second table. Here, you’ll also map the status field values, as you did in the previous step:
- User
can this we done when we are loading the tables from rsds
- Assistant
Yes, it is possible to load tables from an RDS database in Qlik Sense and perform the tasks I described earlier. Here's an example of how to load data using an ODBC connection string from an RDS database and perform field status mapping during load:
- User
I do not want to set the status as done just want to filter it out
- Assistant
Sure, if you only want to filter the records where the value is not "done" (instead of setting a status field), you can use the WHERE clause while loading the data from the RDS database. Here's how you can modify step 3 and 4 from the previous solution to filter records where the values are not "done":
- Load the first table: Use the SELECT statement to load the first table and apply the WHERE clause to filter out records with the "done" value. Here's an example:
Table1: LOAD Common_Field_Name, Field1, Field2 FROM RDS_DB.Connection.Schema.Table1_FilePath WHERE Field1 <> 'done' AND Field2 <> 'done';- Load the second table: Create a load statement that extracts the data from the second table and apply the WHERE clause to filter out records with the "done" value.
Table2: LOAD Common_Field_Name, Field3, Field4 FROM RDS_DB.Connection.Schema.Table2_FilePath WHERE Field3 <> 'done' AND Field4 <> 'done'; - User
need to do it from saved qvd files
- Assistant
Yes, you can load QVD files using QlikView/Qlik Sense script and perform operations like filtering records, joining tables, and setting the field status. Here's how you can modify the previous solution to load the data from saved QVD files instead of RDS database:
- Load the first table from QVD file: Use the LOAD statement along with the file path of the QVD file to load the first table data. You can use the WHERE clause to filter out records that have a "done" value in the selected fields. Here's an example:
Table1: LOAD Common_Field_Name, Field1, Field2 FROM Path\to\Table1.qvd WHERE Field1 <> 'done' AND Field2 <> 'done';- Load the second table from QVD file: Create a load statement that extracts the data from the second QVD file and apply the WHERE clause to filter out records with the "done" value.
- User
It gives red syntax on inner join
- Assistant
I see. The INNER JOIN syntax is not supported in QlikView, instead you can use a concatenation load to join the tables based on the common field. Here's how to modify the earlier solution to use a concatenation load to join the tables in QlikView:
- Load the first table from the QVD file, and filter out records with a "done" value:
Table1: LOAD Common_Field_Name, Field1, Field2 FROM Path\to\Table1.qvd WHERE Field1 <> 'done' AND Field2 <> 'done';- Load the second table from the QVD file, and filter out records with a "done" value:
Table2: LOAD Common_Field_Name, Field3, Field4 FROM Path\to\Table2.qvd WHERE Field3 <> 'done' AND Field4 <> 'done'; - User
It's not picking up the second field from the first table
- Assistant
I see. If the second field from the first table is not being picked up in the concatenated table, it means that the field is either not present in the QVD file or there is a mismatch in the data type or field name between the tables.
To resolve this issue, you can try the following:
-
Check the QVD files: Check the QVD files to make sure that the second field is present and has the same name and data type in both QVD files. You can use a QVD viewer to check the contents of the QVD files.
-
Use long field names: If the second field has a long field name, try aliasing it to a shorter name in both the QVD files and the QlikView script. This can be done using the AS keyword in the LOAD statement:
-
- User
the field name is correct, still it's showing the field not found in concateneted
- Assistant
In that case, you can use the TRACE statement to troubleshoot the issue and find out why the second field is not being concatenated properly.
Here's how you can use the TRACE statement to identify any issues:
- Add TRACE statement: Add a TRACE statement after the load statements in the script to trace the resulting tables.
Table1: LOAD Common_Field_Name, Field1, LongFieldName2 AS Field2 FROM Path\to\Table1.qvd; TRACE Table1; Table2: LOAD Common_Field_Name, Field3, Field4 FROM Path\to\Table2.qvd; TRACE Table2; Concatenated_Table: CONCATENATE (Table1) LOAD Common_Field_Name, Field3, Field4 RESIDENT Table2; TRACE Concatenated_Table; STORE Concatenated_Table INTO 'Path\to\joined_table.qvd' (qvd);-
Reload the script: Reload the script and check the Execution Log (Ctrl+Alt+L) for any errors or warning messages related to the tracing.
- User
there is an issue in concatenated syntax as it's not reading the field from the loaded qvd data
- Assistant
If the field is not being read correctly from the loaded QVD data when concatenating the tables, it could be due to differences in the field name or data type between the two tables. Here's how you can modify the concatenation load statement to ensure that the field is read correctly:
-
Check the field name and data type: Double-check the field name and data type of the field in both tables. Make sure that they are exactly the same. You can use the FIELDNAMES function to check the field names and the FIELDTYPE function to check the data types in QlikView.
-
Use the LOAD statement to rename the field: If the field name is different between the two tables, you can use a LOAD statement to rename the field to match the name in the other table. Here's an example:
Table1: LOAD Common_Field_Name, Field1, LongFieldName2 AS Field2 FROM Path\to\Table1.qvd; Table2: LOAD Common_Field_Name, Field3, Field4 FROM Path\to\Table2.qvd; Concatenated_Table: CONCATENATE (Table1) LOAD Common_Field_Name, Field1, Field3, Field4, LongFieldName2 AS NewFieldName RESIDENT Table2; STORE Concatenated_Table INTO 'Path\to\joined_table.qvd' (qvd); -