Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi community,
I have many different files with the same questions, but different wording.
They are started from qID_2_blabla or qID_3_blabla.
I want, if any question started from qID_2_ save as AAA, if any question started from qID_3_ save as BBB.
Do you have any ideas how it easy to do?
Regards,
Hi Vladimir,
I added mapping table and applymap in the script so it can convert Qnnn to the specific wording per map. As for hte load form SQL - it doesn't matter much. If you load from different tables that have same Q numbers with different wordings, you'll have to repeat this script for each table (except the map of course).
Regards,
Michael
Vladimir,
You can use mapping. For example:
MyMap:
MAPPING LOAD * INLINE [
A, B
qID_2_, AAA
qID_3_, BBB
];
Data:
LOAD
...
applymap('MyMap', left(FieldName,6)) as NewField
...
RESIDENT ...
Regards,
Michael
Hi,
If they are the field values when you can simply write if statement.
Another approach you can use if of for loop.
If you know how much questions are there, then run a loop and check for the questions and bucket them accordinly.
Regards,
Kaushik Solanki
Hi Michael,
It won't be work, because some questions have more than 6 digits like it. qID_385_.
My idea to create universal load, where I only select which the file I want to load.
Thanks,
Hi,
I know only numbers without wording. Because writing is changed from time to time.
I'd like to create universal load, where I can work with constant variable.
Regards,
There is no logical difference... There is some technical difference - you need to find the position of the second '_', and cut all after it.
left(Field, index(Field,'_',2))
Now, you can use it as is, or convert it to something shorter using AutoNumberHash128:
AutoNumberHash128(left(Field, index(Field,'_',2))) as NewField
Thanks for reply,
I used both your ideas.
AutoNumberHash128(left(Field, index(Field,'_',2))) as NewField
Result 1 or 2
left(Field, index(Field,'_',2))
listbox is empty
It implies that there is no two '_' characters in field values... Can you upload an example?
Hi Michael,
Please find the attached file.
Regards,
Vladimir
Please also find xls file.
Thanks,