Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
darrellbutler
Contributor

Generate a Unique Value to replace null

Hi,

I have a table that contains null values, I need to populate this field with a random number in order for it to fit into my link table.

Can anybody recommend the best loop approach to do this, my table does contain a min and max order number that I could use to control the loop.

Rgds

Tags (1)
1 Solution

Accepted Solutions

Re: Generate a Unique Value to replace null

Something like this maybe:

Table1:

Load

      FieldA

     ,FieldB

     ,FieldC

     ,if(len(trim(MyField))=0, autonumber(rand()),MyField) as MyField

From ...somesource...;


talk is cheap, supply exceeds demand
3 Replies

Re: Generate a Unique Value to replace null

Something like this maybe:

Table1:

Load

      FieldA

     ,FieldB

     ,FieldC

     ,if(len(trim(MyField))=0, autonumber(rand()),MyField) as MyField

From ...somesource...;


talk is cheap, supply exceeds demand
Not applicable

Re: Generate a Unique Value to replace null

Hi,

Try autonumber() or RecNo() or RowNo() Functions...

Or

http://adeilson.com.br/2010/02/23/script-para-gerar-numero-randomico-no-sql-server/

Rebeca

darrellbutler
Contributor

Re: Generate a Unique Value to replace null

Thanks guys, is there anyway you can dictate the starting number in an autonumber command, for example I might not want it to start at 1.

Rgds

Darrell

Community Browser