Questions tagged [csqldataprovider]

CSqlDataProvider class for Yii, that allows you to create data providers from custom SQL queries

20 questions
4
votes
0 answers

Npgsql (PostgreSQL) F# sample doesn't compile with unresolved assemblies

I'm trying to test out SqlDataProvider in F# for PostgreSQL, but I fail to compile due to some assemblies not loading. I'm experimenting with VS2019, .net core 3.1. Here are the packages I include. Shouldn't nuget resolve all dependencies? …
3
votes
2 answers

f# SqlDataProvider .Net Core 2.0 - enlisting in ambient is not supported

By day I'm a C# programmer, but an F# enthusiast. whist doing some tutorial (suave) I stumbled upon this error System.NotSupportedException HResult=0x80131515 Message=Enlisting in Ambient transactions is not supported. …
MrD at KookerellaLtd
  • 2,412
  • 1
  • 15
  • 17
3
votes
1 answer

YII2 SqlDataProvider doesn't work relation table value

This is my model Riders:
Stfvns
  • 1,001
  • 5
  • 16
  • 42
2
votes
1 answer

Yii2 gridview + filtering without activerecord

I have a model (but I dont't have a table behind because I want to select information about the database itself): namespace app\models; use Yii; use yii\base\Model; class OracleTables extends Model { public $table_name; public static…
user2511599
  • 796
  • 1
  • 13
  • 38
2
votes
1 answer

Sorting CSqlDataProvider in Yii

I have a rather complex query, that I'm using CSqlDataProvider with: $sql = " SELECT c.id AS id, c.enabled AS enabled, s.store_name AS store_name, s.store_url AS store_url, …
casraf
  • 21,085
  • 9
  • 56
  • 91
1
vote
1 answer

pagination of SqlDataProvider not work me when use the call of a stored procededure

I'm using the SQLDataProvider to call a procedure that returns a list of records but I can't get it to work what i'm trying is: $dataProvider = new SqlDataProvider([ 'sql' => "CALL ErroresEnHoras(:project_id, :fecha_iniciop,…
1
vote
2 answers

Yii2 virtual attribute out of an attribute of a SqlDataProvider

My AddressController: public function actionIndex() { $searchModel = new AddressSearch; $dataProvider = $searchModel->search($_GET); return $this->render('index', [ 'dataProvider' => $dataProvider, 'searchModel' =>…
user2511599
  • 796
  • 1
  • 13
  • 38
1
vote
1 answer

Yii2 SqlDataProvider set params conditionally

I have a huge SQL query in a SqlDataProvider. I'm using simple filtering like this (is it bad practice like this?): !empty($_GET['Search']['A']) ? $A = $_GET['Search']['A'] : $A = "%%"; $dataProvider = new SqlDataProvider([ 'sql' => ' …
user2511599
  • 796
  • 1
  • 13
  • 38
1
vote
1 answer

yii2: SqlDataProvider with pagination and searcModel getting error preg_match() expects parameter 2 to be string, object given

i want to show data using sqlDataProvider to gridview from different table and calculate it, here my code in siteController.php public function actionSyahriyah() { $searchModel = new SyahriyahSearch(); $db = Yii::$app->db; …
1
vote
1 answer

Yii: Get Column names from dynamic query

Is it possible to execute a query and just get the column names of the returned result set. I need the column names since the query is dynamic and I don't know the names of the columns. I will use these column names for sorting when executing the…
neophyte
  • 1,726
  • 3
  • 15
  • 21
0
votes
1 answer

Yii2 gridview running total for each SqlDataProvider row

I have a gridview with an attribute amount. I would like to do a running total ( or subtotal / rollup ) of amount for each row. E.g.: amount rollup 1. 2 2 2. 3 5 3. 2 7 4. 1 8 Is there a way to do this? Can you…
user2511599
  • 796
  • 1
  • 13
  • 38
0
votes
0 answers

Yii2 Filters with Sqldataprovider

I have following code in my search() function of search model. Data is displaying correctly in gridview but i'm not able to use searching functions of gridview. public function search($params) { $totalCount =…
Muhammad Umair
  • 103
  • 1
  • 12
0
votes
1 answer

Yii CSqlDataProvider() and MSSQL - last page bug

I'm using Yii 1.1.16 and CSqlDataProvider() to display data in CGridView. When go to last page I get last PageSize count records, instead number of records on last page. For example, I have grid with 12 record and PageSize set to 10, which means I…
dzona
  • 3,323
  • 3
  • 31
  • 47
0
votes
1 answer

How to make CGridView column sortable using CSqldataprovider?

How to make CGridView columns sortable (On clicking column title) using CSqldataprovider. In controller $sql = "select id ,name, address from User where city = 'ABC' "; $rawData = Yii::app()->db->createCommand($sql); …
Ahsan Mohyuddin
  • 181
  • 1
  • 16
0
votes
0 answers

can't retrieve value from tbgridview yii

I'm using Yii Bootstrap TbGridView to show a DataProvider from CSqlDataProvider. However, I can't display the value out to the screen. I don't know what happened. Here is my code: Controller page: $model = new ReportOptionForm('search'); $sql =…
CnV
  • 381
  • 4
  • 20
1
2