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

How to create another field in an existing table

Hi Folks,

I have an invoice table loaded. One of the field is "Product Name". I am trying to add another field called "Product Group". (Please see attached file. )

The current script is as below,

InvoiceTable:

Load

InvoiceTable.ProductName,

InvoiceNumber,

InvoiceTable.Amount

From

[..\..\OrderDetail.qvd]

(qvd);

5 Replies
Not applicable
Author

Hi,

you missed attachment in your post.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I don't see any attached file.

If the Product Group field is derived (calculated) from the Product Name field you can do it in the same load:

InvoiceTable:

Load

InvoiceTable.ProductName,

InvoiceNumber,

InvoiceTable.Amount,

subfield(InvoiceTable.ProductName, '\', 1) as ProductGroup // this is just an imaginary example

From

[..\..\OrderDetail.qvd]

(qvd);

If you get the information from another source you can load it in another table

Products:

Load ProductName as InvoiceTable.ProductName, ProductGroup

From

[..\..\Products.qvd]

(qvd);

Or you could join the information the the InvoiceTable:

join(InvoiceTable)

Load ProductName as InvoiceTable.ProductName, ProductGroup

From

[..\..\Products.qvd]

(qvd);


Or you could first load the ProductGroups in a mapping table and use the applymap function:

MapGroups:

mapping

Load ProductName, ProductGroup

From

[..\..\Products.qvd]

(qvd);


InvoiceTable:

Load

InvoiceTable.ProductName,

InvoiceNumber,

InvoiceTable.Amount,

applymap('MapGroups',InvoiceTable.ProductName) as ProductGroup

From

[..\..\OrderDetail.qvd]

(qvd);



talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thanks guys,

The attachment is now added. The new field is not an existing field in the database. I have to create it on my own as mentioned in the attachment.

Please help!

Not applicable
Author

Hi,

Try with this:

InvoiceTable:

Load

InvoiceTable.ProductName,

InvoiceNumber,

Pick(WildMatch(ProductName,'M12*','N23*','GE*','TD10*'),'A','A','B','C') as PRODUCTGROUP,

InvoiceTable.Amount

From

[..\..\OrderDetail.qvd]

(qvd);

makkemik
Partner - Contributor III
Partner - Contributor III

Hi

You need the calculate manual in the script which is attached.

But you can make another table included productName or Code with groupCode (A,B,C) then you can join it with your main table.

I hope it will help you

Regards

Murat