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

Creating one field from multiple fields in a load script

Hi

I Have the following fields in my load script

 

LOAD

ZZMLST_ZAEHL1

,
ZZMLST_ZAEHL2

,
ZZMLST_ZAEHL3

,
ZZMLST_ZAEHL4

,
ZZMLST_ZAEHL5

,

I want to create one field from them called Milestone that I can use in my dashboard

6 Replies
Digvijay_Singh

It depends how do you want to build that field, it could be like -

ZZMLST_ZAEHL1 & '-' & ZZMLST_ZAEHL2 &......      as Milestone

alexandros17
Partner - Champion III
Partner - Champion III

LOAD ZMLST_ZAEHL1 & ZZMLST_ZAEHL2 & ..... as Milestone Resident ....

Not applicable
Author

Each of the fields has multiple records and I want to create 1 field to display all of the records

e.g

ZZMLST_ZAEHL1 may contain :

10

20

30

ZZMLST_ZAEHL2 may contain:

40

50

60

I want to create a field so I can see

10

20

30

40

50

60

PrashantSangle

Hi,

look at cross table concept. Might be helpful to you.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

For vCounter = 1 to 5

     LOAD

          '$(vCounter)'     as fieldtype,

          zzmlst'$(vCounter)'     as Milestone

     FROM ...

next

That should perfectly work. You will read the initial table 5 times.

I added a field named fieldtype so you can still see from which field the data came from

If the table contains a lot of data, you should first read the table in memory and then perform the for...next loop as reading it from memory is a lot faster than through ODBC.

settu_periasamy
Master III
Master III

Try this script

Table1:

CrossTable(Field, Data)

LOAD RowNo() as Row1,

  ZZMLST_ZAEHL1,

     ZZMLST_ZAEHL2,

     ZZMLST_ZAEHL3,

     ZZMLST_ZAEHL4,

     ZZMLST_ZAEHL5;

LOAD * INLINE [

     ZZMLST_ZAEHL1, ZZMLST_ZAEHL2, ZZMLST_ZAEHL3, ZZMLST_ZAEHL4, ZZMLST_ZAEHL5

    16, 45, 89, 35, 52

    85, 69, 12, 40, 10

    18, 50, 62, 79, 40

    71, 100, 37, 84, 79

    19, 32, 13, 25, 97

    16, 76, 47, 40, 39

];

NoConcatenate

Load Data as Milestone Resident Table1;

DROP Table Table1;