Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all.
I have a table similar to this:
Translate:
Load *Inline [
source, ENG, GER, 3_let_code
s1, English, Deutsch, head_1
s1, Select your language, Bitte wählen Sie Ihre Sprache, head_2
s1, Customer Feedback, Kundenfeedback, head_3
];
And I need to make somehow crosstable load to receive this result:
head_1 | head_2 | head_3 | 3_let_code |
English | Select your language | Customer Feedback | ENG |
Deutsch |
Bitte wählen Sie Ihre Sprache | Kundenfeedback | GER |
And unfortunately I can't get how to get desired result. Maybe someone could help me with the idea how to deal with this issue?
Translate:
Load *
Inline[
source,ENG,GER,3_let_code
s1,English,Deutsch,head_1
s1,Selectyourlanguage,BittewählenSieIhreSprache,head_2
s1,CustomerFeedback,Kundenfeedback,head_3
];
// 1. Build a table with all languages from fieldnames
for i=1 to NoOfFields('Translate')
fn=FieldName(i,'Translate')
if not Match('$(fn)','source','3_let_code') then
LangTab:
load
'$(fn)' as Language
AutoGenerate 1;
endif
next i
// 2. Generic load of all languages
for each lang in FieldValueList('Language')
tmp:
Generic LOAD
'$(lang)' as Language,
"3_let_code",
"$(lang)"
Resident Translate;
next lang
// 3. Join all generated tables
for i=NoOfTables() to 1 step -1
let tn=TableName($(i));
if WildMatch('$(tn)','tmp.*') then
left join(LangTab)
load * resident "$(tn)";
drop table "$(tn)";
end if
next i
// Finally
DROP table Translate;
RENAME Field Language to "3_let_code";
Translate:
Load *
Inline[
source,ENG,GER,3_let_code
s1,English,Deutsch,head_1
s1,Selectyourlanguage,BittewählenSieIhreSprache,head_2
s1,CustomerFeedback,Kundenfeedback,head_3
];
// 1. Build a table with all languages from fieldnames
for i=1 to NoOfFields('Translate')
fn=FieldName(i,'Translate')
if not Match('$(fn)','source','3_let_code') then
LangTab:
load
'$(fn)' as Language
AutoGenerate 1;
endif
next i
// 2. Generic load of all languages
for each lang in FieldValueList('Language')
tmp:
Generic LOAD
'$(lang)' as Language,
"3_let_code",
"$(lang)"
Resident Translate;
next lang
// 3. Join all generated tables
for i=NoOfTables() to 1 step -1
let tn=TableName($(i));
if WildMatch('$(tn)','tmp.*') then
left join(LangTab)
load * resident "$(tn)";
drop table "$(tn)";
end if
next i
// Finally
DROP table Translate;
RENAME Field Language to "3_let_code";
Hey @cwolf Thank you for a fresh ideas you shared😊. This solution definitely forks for me.