Get KoolPHP UI with 30% OFF!

Error on DS SQL Server

Carlos Eduardo
Hello all, how are you ?
I have this code:
<?php 
    /*
     * Please put this file in the same folder with KoolControls folder
     * or you may modify path of require and scriptFolder to refer correctly
     * to koolpivottable.php and its folder.
     */
    require "kphp/KoolControls/KoolPivotTable/koolpivottable.php";
 
    $dbcon = sqlsrv_connect('localhost', array( 'Database'=>'IOCP', 'UID'=>'sa', 'PWD'=>'Guardian*01'));
 
	$ds = new SQLSVRPivotDataSource($dbcon);
    $ds->select("ANOFISCAL, ANOMESFISCALINT, N3, CMV_PLANEJADO, MARKDOWN, CMV_REALIZADO, ESTOQUE_FINAL_CUSTO_PLANEJADO, ESTOQUE_DISPONIVEL_CUSTO, ESTOQUE_RECEBIMENTOS_CUSTO, ESTOQUE_TOTAL_DISPO_CUSTO, OTB_PROX_PERIODO, PEDIDOS_CONSUMO, OTB_DISPO      ")
       ->from("otb_inseason");
    //   ->selectCommand("SELECT * FROM otb_inseason");
    $pivot = new KoolPivotTable("pivot");
    $pivot->scriptFolder = "KoolControls/KoolPivotTable";
    $pivot->DataSource = $ds;
 
    $pivot->Pager = PivotPrevNextAndNumericPager();
    $pivot->AllowCaching = true;
    $pivot->ExportSettings->IgnorePaging = true;
    $pivot->ExportSettings->config(array(
            "fileName"=>"CompassExport",));
 
    $field = new PivotSumField("CMV_PLANEJADO");
    $field->Text = "CMV Planejado";
    $field->DecimalNumber = 2;
    $field->DecimalPoint = ",";
    $field->ThousandSeperate = ".";
    $field->FormatString = "R$ {n}";
    $pivot->AddDataField($field);
 
    $field = new PivotSumField("MARKDOWN");
    $field->Text = "Markdown";
    $field->DecimalNumber = 2;
    $field->DecimalPoint = ",";
    $field->ThousandSeperate = ".";
    $field->FormatString = "R$ {n}";
    $pivot->AddDataField($field);
 
    $field = new PivotField("N3");
    $field->Text = "Nível 03 EM";
    $pivot->AddRowField($field);
 
    $field = new PivotField("ANOMESFISCALINT");
    $field->Text = "Mês";
    $field->AllowReorder = true;
    $pivot->AddColumnField($field);
 
    $pivot->Process();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>KoolPivotTable</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    </head>
    <body>
        <?php echo $pivot->Render(); ?>
    </body>
</html>

But im having problem with the datasource ... I have other PHP application working ok.
Tks
Posted Feb 24, 2019 Kool
Carlos Eduardo
Error Message:
Fatal error: Uncaught Error: Class 'SQLSVRPivotDataSource' not found in C:\Program Files\NetMake\v9\wwwroot\compass_pivot.php:11 Stack trace: #0 {main} thrown in C:\Program Files\NetMake\v9\wwwroot\compass_pivot.php on line 11
Posted Feb 24, 2019 Kool
Carlos Eduardo
Is the class SQLSVRPivotDataSource ok in koolphp ?
I took the example like this in the koolphp site code generator itself.
I changed the connection to the sql server and it was quiet, but it ran into this class.
I did not renew the signature koolreport because you have not released anything new. But I have koolreport signed until 2020.
If anyone can give a tip, I'll be grateful.
Thank you.

Posted Feb 24, 2019 Kool
Carlos Eduardo
Wow i had this erros in past hahahaha
https://www.koolphp.net/forum/threads/234.1/class-039sqlsvrpivotdatasource039-not-found-in--error.html
this point is ok ... but ... now occur a new problem
Posted Feb 24, 2019 Kool
Anthony Amolochitis
Sometimes I would get datasource errors when I encountered an empty set in the select statement.
Maybe check that. I have the source code version of KoolPHP, so sometimes I'll fix the issue quickly, and submit the ticket to KoolPHP with my solution.
I'll ask them to double check it and add it to their updated version when they update it.
Anyways, when you get the error, check the sql results to see if it returns an empty set. That is likely the error with datasource.
If a class is not found, make sure you have the file. Otherwise submit a ticket to the guys at KoolPHP. They usually get it handled pretty quickly.
Let me know if I helped you out Carlos.
Take care
Posted Feb 25, 2019 Kool