Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jblomqvist
Specialist
Specialist

Is it possible to do randomise the field to Order By?

Hi all,

Let's say I have the following table:

LOAD
OrderID,

OrderDate,

CustomerID,

ProductID

Value

Resident <table>

Order By OrderDate

Is it possible in the above to randomly swap the field to order by?

Say it's OrderDate but in the next reload it can randomly order by CustomerID or ProductID.

How is it possible to do this? Any ideas?

1 Solution

Accepted Solutions
sunny_talwar

May be like this (Have not tested this, but I think it should work):

LET vRand = Ceil(Rand() * 3);

LET vField = Pick($(vRand), 'OrderDate', 'CustomerID' , 'ProductID');

LOAD
OrderID,

OrderDate,

CustomerID,

ProductID

Value

Resident <table>

Order By $(vField);

View solution in original post

1 Reply
sunny_talwar

May be like this (Have not tested this, but I think it should work):

LET vRand = Ceil(Rand() * 3);

LET vField = Pick($(vRand), 'OrderDate', 'CustomerID' , 'ProductID');

LOAD
OrderID,

OrderDate,

CustomerID,

ProductID

Value

Resident <table>

Order By $(vField);