Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to allign rows and columns

John Doe
IDDate BoughtProduct Bought
0011/1/2011Case 1
0021/2/2011Case 2
0031/3/2011Case 3
Mary Wu
IDDate BoughtProduct Bought
0041/4/2011Case 4
0051/5/2011Case 5
Linda Jones
IDDate BoughtProduct Bought
0061/6/2011Case 6
0071/7/2011Case 7
Joe White
IDDate BoughtProduct Bought
0081/8/2011Case 8
0091/9/2011Case 9
Jim Kenny
IDDate BoughtProduct Bought
01012/31/2015Case 10

I have the above table that needs rows and columns to be alligned  as in the post below:

IDDate BoughtLast NameProduct Bought
0011/1/2011DoeCase 1
0021/2/2011DoeCase 2
0031/3/2011DoeCase 3
0041/4/2011WuCase 4
0051/5/2011WuCase 5
0061/6/2011JonesCase 6
0071/7/2011JonesCase 7
0081/8/2011WhiteCase 8
0091/9/2011WhiteCase 9
01012/31/2015KennyCase 10

Thanks much appreciated

18 Replies
Anonymous
Not applicable
Author

Can you explain the below code pls Digvijay‌ I would really appreciate. Many Thanks

Remove(Row, RowCnd(CellValue, 1, StrCnd(null))),

Digvijay_Singh

Hi,

This code to transform table is auto-generated by Transformation Wizard, This specific code I think is generated when I deleted one of the blank row at top while transforming table through wizard.

Anonymous
Not applicable
Author

what is your data source ?  inline load ? csv? Excel? if excel or csv then plz share that.....

Anonymous
Not applicable
Author

HI everyone Thanks for the input. This is a sample file. My actual app has more data. I understand i need to use enable transformation wizard for this. Can you explain what step in that wizard removes empty coulmns row 5, 14, 19, 20, 21 and what step replaces John Doe, Mary Wu etc to a new column (see the attached image for this).

I want to understand how exactly this is done in the wizard, so pls help me out.

Thanks againalign fields.PNG

Anonymous
Not applicable
Author

here is the excel file also

Anonymous
Not applicable
Author

Digvijay, i worked with Enable Transformation wizard and I understand how you got the 1st line of code:

Remove(Row, RowCnd(CellValue, 1, StrCnd(null)))


but I did not understand how u got the remaining 2 lines:


Remove(Row, RowCnd(CellValue, 1, StrCnd(contain, 'ID'))),

Remove(Col, Pos(Top, 3))

Attached image shows how I got that line.It was not allowing me to remove another line as in your 2nd line.

can you pls explain what steps you took in the wizard. Thank you very much.

align fields 2.PNG

Digvijay_Singh

I tried to compile the steps in word doc, attaching here for your reference along with qvw, I am sure it will help you to handle your file if it is more or less same with the posted sample.

the script is as below, the script in bold below is manual script to take last name as you wanted and to format date and ID. -

I am not sure why but formatting ID and Date Bought wasn't working as it should be, so I had to give them different name, to keep the same name you can interchange them with T1 table.

T1:

LOAD @1 as ID,

     @2 as [Date Bought],

     @3 as [Product Bought],

     @4 as [Last Name]

FROM

[allign rows.xlsx]

(ooxml, no labels, table is Sheet2, filters(

Remove(Row, RowCnd(CellValue, 1, StrCnd(contain, 'ID'))),

Remove(Col, Pos(Top, 3)),

ColXtr(1, RowCnd(CellValue, 2, StrCnd(null)), 0),

ColXtr(1, RowCnd(CellValue, 2, StrCnd(null)), 0),

Replace(4, top, StrCnd(null)),

Remove(Row, RowCnd(CellValue, 2, StrCnd(null)))

));

NoConcatenate

Final:

Load

  Floor(ID) as ID1,

  Date(Floor([Date Bought])) as [Date Bought1],

  [Product Bought],

  Subfield([Last Name],' ',2) as [Last Name]

Resident T1;

Drop Table T1;

Hope it helps to manage your task.

Digvijay_Singh

The qvw attached here

Anonymous
Not applicable
Author

Digvijay‌ Thank you so much for your elaborate instruction. Its all clear now.