Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Hi Anil,
thanks,
if its have n no of records with multiple dist,tal,mundal how we can achieve.
we need three columns dynamically if values are different.
we will get dynamically columns in this situation?
Regards
Sathish
May be try this? This will dynamically create the fields based on number of Distinct statecodes.
Table1:
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
444, Guntur
444, Vadi
444,
555, Ongole
555, Vadi
555, khammam
555, Adilabad
555, Guntur
666, Prakasham
666, Karimnagar
];
ISLAND:
LOAD DISTINCT statecode AS stateCnt
Resident Table1;
LET vCnt = NoOfRows('ISLAND');
For i = 1 to $(vCnt)
NoConcatenate
Table1:
LOAD statecode,
subfield(distance, ';', $(i)) AS dist$(i)
Resident Table1;
Next i ;
Drop Table Table1;
Hi Vishwarath Nagaraju,
can you share me the qvw file am getting wrong result.
Regards
Sathish
Hi
PFA
Regards
Here it is.
Hi Nagaraju,
1).here each dist we are creating one column but if we have 10000 number off rows we will get 10000 columns right?
here for loop will create huge columns.
2). one more thing here i need to check 3 columns and need to provide three separate columns for each record.
Regards
Sathish
for just having three column you can change the for loop counter.
just change $(vCnt) with three in Nagaraju Code.
Hi Agarwal,
here we are getting lots off tables if records have 1cror what should need to do, we cant create 1 cror tables here right?
i need front end Possibility to create dynamical columns.
Ex: if 1 record have 5 different dist that five need to convert separate columns.
if we have 1 record 1000 different dist how we can we cont store that much tables in data model it will give performance issue surely
Regards
Sathish
Yes, it will not load properly and can freeze. So what exactly your requirement and why you need like 1000 columns, i am pretty much sure any User would like or have time to view those 1000 columns or how many ever. Picking up the most important columns should be your priority.
However, what is your actual data source and how the data looks can you explain a little more in your requirement?
I am sorry was this your requirement or you just wanted to know what happens if we have 1000 rows of data coming?
Hi Nagaraju,
my users asking based on one CID they want to see 1 product id as a column like how many products they purchased that all products they want to see in columns and also product weight also separate columns each product wise like this my user requirement.
finally they want like below.
CID PID Pweight PID Pwieght .........
1). here they want dynamically columns generation based on products.
2). they want to compare each CID.
Regards
Sathish.