Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Akina0929
Creator
Creator

how to add columns dynamically in straight table?

Hi,

  I have table that consist

Pid,  Pname

1      ,mango

2      ,coriander

3      ,pepper

if the pid again comes it needs to same columns beside like following

pid, pname,     pid,   pname

1   ,mango,       1    , banana

2   ,coriander

3   ,pepper        3    ,sapota

dynamically it needs to add columns to table if the same pid is comimg again and again . how can i achieve please help me.

25 Replies
DavidFoster1
Specialist
Specialist

I dont think this is possible to achieve without using macros. Why are you trying to do this?

vinieme12
Champion III
Champion III

how exactly is pid coming again?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anil_Babu_Samineni

What was the logic behind? Where you are getting pid again? Will you able to explain little more?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Akina0929
Creator
Creator
Author

in the same pid different pnames are there, if the same pid and different pname comes it needs to add separate column to the straight table

Akina0929
Creator
Creator
Author

HI Anil,

I have following table,

state code  ,dist

111           ,guntur

111           ,prakasam

111            ,ongole

222          ,adilabad

222          ,khammam

333           ,vadi

  I want to show above data  to like as follows

state code   ,dist          ,dist               ,dist

111               ,guntur     ,prakasam     ,ongole

222               ,adilabad, khammam

333                ,vadi

is it posssible to show like this please help me

Thanks & Regards

Anjaneyulu

vinieme12
Champion III
Champion III

would this work?

Create a Straight table

Dimension

StateCode

Expression

Concat(Distinct dist,'; ')

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Akina0929
Creator
Creator
Author

hi vineeth,

     not in single column ,it needs to create separate columns

Anil_Babu_Samineni

Haha, That's not possible. Could be possible with Adhoc Reports. Work around may be this?

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

Using vineeth's expression try like below:

Table1:

LOAD statecode, subfield(distance, ';',1) AS dist1,

subfield(distance, ';',2) AS dist2,

subfield(distance, ';',3) AS dist3;

LOAD statecode, Concat(dist,';') AS distance

Group By statecode;

LOAD * INLINE [

statecode  ,dist

111 ,       guntur

111 ,       prakasam

111 ,       ongole

222 ,       adilabad

222 ,       khammam

333 ,       vadi

];