Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

Not applicable

Autogenerate an ID (between 1 - 30) for already existing 16384 records

I'm trying to autogenerate an ID for a set of already existing records.

Let me explain: I've two tables, namely, Shipments and Suppliers. The "SupplierID" in Suppliers table is having a column with values from like 1 - 30. Now I want to add a column called "SupplierID" in Shipments table as well, which is containing records of some 16300+.. So obviously the "SupplierID" values should repeat between 1- 30 for all those 16300+ rows..

I am trying to find out a method to do this, using a for loop or something in order to auto generate the "SupplierID" in the Shipments table for each of its rows.

LOAD

<I want to loop this column using 'for' loop from 1-30 values for the 16300+ rows in Shipments table>

SUPPLIER ID autogenerate,

CustomerID,

OrderDate,

OrderID,

Cost,

Customer,

Product,

ProductID

FROM

(biff, embedded labels, table is Shipments$)

HELP!!

Tags (3)
4 Replies
Employee
Employee

Re: Autogenerate an ID (between 1 - 30) for already existing 16384 records

Is there any other way of associating these two tables?

Or you just want to generate random values from 1 to 30 to your Shipments table?

morris70
Valued Contributor

Re: Autogenerate an ID (between 1 - 30) for already existing 16384 records

Hi

Could you please show what fields your Supplier table contains? I think what Agis is touching on is what do you want to achieve with the autogeneration of numbers? By doing this you will only generate random connections between Shipments and Suppliers.

Not applicable

Re: Autogenerate an ID (between 1 - 30) for already existing 16384 records

Hi Kanth,

If I understand your first 4 lines of question right, by normally associating Shipments Table with Suppliers, you can achieve this. If SupplierID has 30 distinct values (1-30), after association, they would assign to those ~16K records in Shipments.

Let us know if you need to achieve something else.

Thanks & Regards,

Madhu

Not applicable

Re: Autogenerate an ID (between 1 - 30) for already existing 16384 records

Hi

I guess you want to link your 2 tables on Suppllier ID.

May be you can JOIN tables on Product ID because i believe one product is provided ONLY by one supplier.

ypou will then get the right Supplier ID in both tables

best regards

Chris

Community Browser