Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have data being populated in an excel form such as this that I'm loading into my application...
column A |
---|
Field A: This is the data for Field A. |
Field B: Some other data is populated here. |
Field C: Still some other data to be found here. |
Field 😧 Yet other data here. |
... |
... |
Field X: Something more here. |
I would like to structure the load so that I have a resulting table such as this...
Field A | Field B | Field C | Field D | Field X |
---|---|---|---|---|
This is the data for Field A. | Some other data is populated here. | Still some other data to be found here. | Yet other data here. | Something more here. |
Any suggestions appreciated!
Load script like this:
Temp:
LOAD * INLINE [
column A
Field A: This is the data for Field A.
Field B: Some other data is populated here.
Field C: Still some other data to be found here.
Field 😧 Yet other data here.
Field X: Something more here.
];
FOR i=1 TO NoOfRows('Temp')
LET Field = '[' & SUBFIELD(PEEK('column A', $(i)-1, 'Temp'), ': ', 1) & ']';
LET Value = CHR(39) & SUBFIELD(PEEK('column A', $(i)-1, 'Temp'), ': ', 2) & CHR(39);
IF $(i) = 1 THEN
Data:
LOAD $(Value) AS $(Field)
AutoGenerate 1;
ELSE
LEFT JOIN (Data)
LOAD $(Value) AS $(Field)
AutoGenerate 1;
ENDIF
NEXT
Will return a table that looks like this:
Field A | Field B | Field C | Field D | Field X |
---|---|---|---|---|
This is the data for Field A. | Some other data is populated here. | Still some other data to be found here. | Yet other data here. | Something more here. |
Load script like this:
Temp:
LOAD * INLINE [
column A
Field A: This is the data for Field A.
Field B: Some other data is populated here.
Field C: Still some other data to be found here.
Field 😧 Yet other data here.
Field X: Something more here.
];
FOR i=1 TO NoOfRows('Temp')
LET Field = '[' & SUBFIELD(PEEK('column A', $(i)-1, 'Temp'), ': ', 1) & ']';
LET Value = CHR(39) & SUBFIELD(PEEK('column A', $(i)-1, 'Temp'), ': ', 2) & CHR(39);
IF $(i) = 1 THEN
Data:
LOAD $(Value) AS $(Field)
AutoGenerate 1;
ELSE
LEFT JOIN (Data)
LOAD $(Value) AS $(Field)
AutoGenerate 1;
ENDIF
NEXT
Will return a table that looks like this:
Field A | Field B | Field C | Field D | Field X |
---|---|---|---|---|
This is the data for Field A. | Some other data is populated here. | Still some other data to be found here. | Yet other data here. | Something more here. |
Thanks Nicole!!!