Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using a loop to load multiple scores for each record

Hi have an Excel database with the following columns:

RecordID; {ScoreA}; {ScoreB}; {ScoreC}; ....

The {ScoreA}, {ScoreB} etc will be the description of the scores with the score values in each column and won't be 'ScoreA', 'ScoreB', etc.

I want to load the data so that for each Record ID, the score value is linked to the score description.  I can use:

LOAD RecordID,

    {ScoreA} as score,

    'ScoreA' as ScoreType

FROM ...

LOAD RecordID,

    {ScoreB} as score,

    'ScoreB' as ScoreType

FROM ...

...

How do I use a loop to load the data more elegantly?

4 Replies
hic
Former Employee
Former Employee

Isn't this just a crosstable?  The Crosstable Load

HIC

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Or to put it in "code":

Scores:

CROSSTABLE (1, ScoreType, Score)

LOAD RecordID, ScoreA, ScoreB, ScoreC

FROM ...

Now create a pivot table with dimensions RecordID and ScoreType and pivot ScoreType to a horizontal level. Add =Sum(Score) as Expression. Does it look the same? Though the data has now been serialized as you can observe in the Table Viewer (Ctrl-T)

Best,

Peter

Anonymous
Not applicable
Author

I removed the "1, " and it worked perfectly.  Thanks!

sasiparupudi1
Master III
Master III

Please close the thread by marking the correct answer