Link to home
Start Free TrialLog in
Avatar of DeviVenkata
DeviVenkata

asked on

ESQL C programming to create XLS file

Hi,

Iam getting an "-NaNQ" error on writing float values into xls.

/* Following is the query which gets the sum of 2 amounts (decimal values)from a table*/
sprintf(szSQLSelect,"Select case when (select sum(ac.amt1+ac.amt2) from "
                                 "Account_table ac ) <= 0 then 0.0000 else " 
                                " (select sum(ac.amt1+ac.amt2) from Account_table ac ) end actual");

/* the query is excuted and the actual amount is fetched into the float variable "factualamt" */
$double factualamt;
EXEC SQL FETCH POWeeklySelectStmt_c INTO :factualamt;

/* Now im writing that value into the xml file as follows */
    fprintf(gszReportFileName,"<Row> \n");
   if( fActualAmt != 0.0000  ){
 fprintf(gszReportFileName,"\t\t<Cell><Data ss:Type='Number'>%4lf</Data></Cell>\n <\Row>\n",  fActualAmt);
    }
     else{
    fprintf(gszReportFileName,"\t\t<Cell><Data ss:Type='Number'>%4lf</Data></Cell>\n <\Row>\n",  0.0000);
     }


Error:
But when i execute the program , i get an error while opening the xls saying that the data is an "-NaNQ"

Cause for error:
This error occurs whenever the amount value in the table is NULL.

Please help me with this issue

Regards
Devi

ASKER CERTIFIED SOLUTION
Avatar of itsmeandnobodyelse
itsmeandnobodyelse
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DeviVenkata
DeviVenkata

ASKER

thanks ya

it worked