Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Guys,
I have 15 columns in a table, but I want to generate keys using autonumber function for all the combinations of that 15 columns. Is it possible to do by script wise?
See if this helps
Should be possible...
AutoNumber(Field1&Field2&Field3&.....&Field15) as Key
Autonumber (key1&'|'&Key2&'|'&.........)
No, I want all the combinations. I mean
for example, for three columns itself I want these much of combinations,
AutoNumber(Field1&Field2&Field3) as Key
AutoNumber(Field1&Field3&Field2) as Key1
AutoNumber(Field3&Field1&Field2) as Key2
AutoNumber(Field2&Field1&Field3) as Key3
.
.
.
So, it goes on. Likewise, is it possible to generate key for all the combinations of 15 columns.
I think so... the only change I would do is this
AutoNumber(Field1&Field2&Field3, 'Key') as Key
AutoNumber(Field1&Field3&Field2, 'Key1') as Key1
AutoNumber(Field3&Field1&Field2, 'Key2') as Key2
AutoNumber(Field2&Field1&Field3, 'Key3') as Key3
.
.
.
Thank you. But do I have to write all the combinations of 15 columns or can I use loop function for that?
that menas 15 * 15 = 225 combinations?
yes exactly..
I guess you might be able to loop... let me see if there is an option
This is for 3 fields, but can be expanded to 15 fields
Table:
LOAD *,
RowNo() as UK;
LOAD * Inline [
ABC, DEF, GHI
1, 2, 3
92, 32, 54
3, 4, 2
];
FieldNames:
LOAD * Inline [
FieldName
ABC
DEF
GHI
];
FinalTable:
LOAD UK
Resident Table;
FOR i = 1 to FieldValueCount('FieldName')
LET vField1 = FieldValue('FieldName', $(i));
LET vField2 = FieldValue('FieldName', If($(i)+1 > 3, FieldValueCount('FieldName') - $(i) + 1, $(i)+1));
LET vField3 = FieldValue('FieldName', If($(i)+2 > 3, FieldValueCount('FieldName') - $(i) + 2, $(i)+2));
Left Join (FinalTable)
LOAD UK,
AutoNumber([$(vField1)]&'|'&[$(vField2)]&'|'&[$(vField3)], 'Key'&$(i)) as [Key$(i)]
Resident Table;
NEXT i