Yii Framework Forum: Merging Csqldataprovider Into One Based On Common Column - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Merging Csqldataprovider Into One Based On Common Column Rate Topic: ***** 1 Votes

#1 User is offline   sefburhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 136
  • Joined: 08-February 12
  • Location:islamabad

Posted 25 April 2013 - 01:12 AM

Can i Merge two different CSqlDataProvider (dataproviders) into one? if possible Please help me! I search but found only merging of criteria which is NOT working for me!.
thank
Burhan
0

#2 User is offline   Fabrizio Caldarelli 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 284
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 25 April 2013 - 02:53 AM

Are you making an UNION between sql provider?
0

#3 User is offline   sefburhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 136
  • Joined: 08-February 12
  • Location:islamabad

Posted 25 April 2013 - 11:47 PM

View PostFabrizio Caldarelli, on 25 April 2013 - 02:53 AM, said:

Are you making an UNION between sql provider?


thanks for reply, i m not making UNION BUT i want to merge two data provider: my problems is "

I have to show the result of data which is filter and full and comparion with them in cgridview
id
filterData:
Percentage:
fullData:
etc
"

I had the problem in writing SQL(like having both inlist and all !!) query,so i was thinking if we can merge the dataproviders, then it easy then!!
0

#4 User is offline   Fabrizio Caldarelli 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 284
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 26 April 2013 - 01:53 AM

With a problem of this type, i've subclassed CGridView and then rendered footer's cell with specific method
to display correctly result of data.

Anyway, you could try to use GROUP BY .... WITH ROLLUP function (if you are using MySQL for example) at the end of sql,
but i don't know your sql to say that this could be implemented easily.
0

#5 User is offline   sefburhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 136
  • Joined: 08-February 12
  • Location:islamabad

Posted 26 April 2013 - 02:02 AM

View PostFabrizio Caldarelli, on 26 April 2013 - 01:53 AM, said:

With a problem of this type, i've subclassed CGridView and then rendered footer's cell with specific method
to display correctly result of data.

Anyway, you could try to use GROUP BY .... WITH ROLLUP function (if you are using MySQL for example) at the end of sql,
but i don't know your sql to say that this could be implemented easily.


thanks for reply
0

#6 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 360
  • Joined: 23-January 11

Posted 27 April 2013 - 12:57 AM

View Postfburhan89, on 25 April 2013 - 01:12 AM, said:

Can i Merge two different CSqlDataProvider (dataproviders) into one? if possible Please help me! I search but found only merging of criteria which is NOT working for me!.
thank
Burhan


I've once did a similar task: I needed a custom data provider that gets data from two sources. Basically, I've created a custom class that extends CDataProvider. This class implemented the following methods in order to achieve what I needed to override __construct(), fetchData(), fetchKeys(), calculateTotalItemCount() plus write several custom methods.

I suggest that if you cannot escape your need that you 'dive into' CDataProvider and create your own custom one.
Therapeutic PHP sessions My LinkedIn Profile
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users