Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi together,
I am new in Qv and now I have the following problem:
I have two SQL Tables with the same fields. I load them in QV and then I want to join thel in one table (I think it should not be a problem as they have same fields) but before joining I want to add one field for the first one and one for the second and I want this field to have user defined value(I want to define the value in the csript, not with input field). For example I have one table with customers and one with suppliers and when I join the tables in QV I want to have a field with info which record is customer and which is supplier.
Thanks in advance!
hello plss , provide you problem clearly.
Moeover u can alias or rename field name in qvw.
I will give an example:
CustomerTable:
ID Name Address
1 CSCS New York
2 DDDD Chicago
SupplierTable:
ID Name Address
1 FGFGF New York
2 DSRYJ Chicago
So I want to join them in this way:
ID Name Address
1 FGFGF New York
2 DSRYJ Chicago
1 CSCS New York
2 DDDD Chicago
but I want to add extra field, so it look like this:
Type ID Name Address
Supplier 1 FGFGF New York
Supplier 2 DSRYJ Chicago
Customer 1 CSCS New York
Customer 2 DDDD Chicago
Hello,
There are several ways to do that. If both tables are not related but you want them to be just one table, you can concatenate them:
Table:LOAD *, 'Customers' AS RECORD_TYPE;SQL SELECT *FROM Table;CONCATENATE // Not needed if both tables have exactly same number and names of fieldsLOAD *, 'Suppliers' AS RECORD_TYPE;SQL SELECT *FROM Tabl2;
This will append Suppliers data to Customers data. If they are related (say Invoice headers and lines) you can join them
InvoiceData:LOAD *, Year & '/' & InvoiceNo AS DOCUMENT_NO;SQL SELECT *FROM InvoiceHeaders;JOINLOAD *, Year & '/' & InvoiceNo AS DOCUMENT_NO;SQL SELECT *FROM InvoiceLines
You can use any QlikView function to create new fields in your LOAD statement.
Hope that helps.
Hi,
If i understood your question properly. Below is the code.
Load Id,
Name,
Address
'Customer' as Type
From Customer_Table;
CONCATENATE
Load Id,
Name,
Address
'Supplier' as Type
From Supplier_Table;
Hope this may help you.
- Sridhar
Thank You very much. It works. This was really stupid question, but as I said I am new in QV.
Thanks