Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I am planning to first extract 25% from each of the following subsets of a table:
Then I would like to append the 3 tables. I am having trouble finding a way to append inside set expression.
Is there a function that can do this for me? Please advice!
Many thanks in advance!
Can you give a sample to play with ?
Sorry I don't have any samples, I am just looking for a function that can append the following tables (Replacing the + sign)
aggr(Only({$<group={'1'}>}Name) + aggr(Only({$<group={'2'}>}Name) + aggr(Only({$<group={'3'}>}Name)
What is the aim behind your question? Usually such things needs to be done within the datamodel and I assume that's the case for you, too.
- Marcus
I am looking to have a random sampling of N amounts (based on user input) from each of the 3 groups and show the final result in a table
Like hinted I doubt that there is really a practicable way to do it directly with any function within the UI and also not with different tables. If I had such a task I would probably go in the following direction by merging the data within a single table and precalculating an appropriate flag, like:
t4: load *, mod(recno(), 100) + 1 as Flag from t1;
concatenate(t4) load *, mod(recno(), 100) + 1 as Flag from t2;
concatenate(t4) load *, mod(recno(), 100) + 1 as Flag from t3;
With it each source will be divided into 100 parts. The users could now within the UI select the group value which they like and the parts from 1 to 100 to get a more or less random sub dataset from the entire dataset. IMO there is rather no way to get a totally ramdomly dataset - whereby you could extend the logic by switching from recno() to rowno() and/or using both in some way and/or pre-loading the data and applying various sorting picking any available field and assigning it to a variable which is then used within an order by statement mayby with:
let var = pick(ceil(rand()*20), 'Field1', 'Field2', ...);
and then:
load * from X order by [$(var)];
You may also combine multiple fields and adding another logig for asc/desc ...
- Marcus