Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Failed to set String format in report from SQLite3
Failed to set String format in report from SQLite3 [message #12984] Mon, 03 December 2007 04:19 Go to next message
fuqr is currently offline  fuqr
Messages: 16
Registered: July 2007
Location: Singapore
Promising Member
My problem occured as in the following code:
=====================================================
String r_title;
try
{
SQL & ::Select(DESCRIPTION).From(CASES).Where(ID == dtid);
while(SQL.Fetch()) r_title = SQL[0];
}
catch(SqlExc &e)
{
Exclamation("[* " + DeQtfLf(e) + "]");
}

Report r;
Image img = Images::LargeIcon;
r.Header("[A2> Page $$P");
RichObject CreateImageObject(const Image& img, int cx = 10, int cy = 10);
r.DrawImage(10, 10, 500, 500, img);

r << " && [*= " << r_title; // problem here ???

r << "&& [_= Analysis Report]&";
String tab;
........
r << tab;
Perform(r);

==========================================
"r_title" failed to display as defined:"Centeralignment & Bold".
Even if I trid:
r << "&& [=* " << AsQTF(ParseQTF(r_title)); and
r << " [=* TEST CASE" << AsString(Format("%s",r_title));

But the constant text is OK.

If there are some String format commands can be deployed here?

Thanks in advance!

Re: Failed to set String format in report from SQLite3 [message #12993 is a reply to message #12984] Tue, 04 December 2007 10:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
fuqr wrote on Sun, 02 December 2007 22:19

My problem occured as in the following code:
=====================================================
String r_title;
try
{
SQL & ::Select(DESCRIPTION).From(CASES).Where(ID == dtid);
while(SQL.Fetch()) r_title = SQL[0];
}
catch(SqlExc &e)
{
Exclamation("[* " + DeQtfLf(e) + "]");
}



I would use:

String r_title = SQL % Select(DESCRIPTION).From(CASES).Where(ID = = dtid);


Quote:


r << " && [*= " << r_title; // problem here ???



Ideed. The trouble is that Report treats any "<<" inserted QTF separately - formatting is lost for t_title.

r << " && [*= " + r_title; // problem here ???

should work ("+" has precendence over "<<").

Anyway, one usual way is to create the whole report as String and then put into the Report. Also, consider DeQtf for r_title to remove any accidental characters used by QTF.

#include <Report/Report.h>

using namespace Upp;

GUI_APP_MAIN
{
	String r_title = "This is [MY TITLE!]";

	String qtf;
	qtf << " && [*= " << DeQtf(r_title)
	    << "&& [_= Analysis Report]&";
	
	Report r;
	r.Header("[A2> Page $$P");
	r << qtf;
	Perform(r);
}


Mirek
icon7.gif  Re: Failed to set String format in report from SQLite3 [message #13005 is a reply to message #12984] Wed, 05 December 2007 03:03 Go to previous message
fuqr is currently offline  fuqr
Messages: 16
Registered: July 2007
Location: Singapore
Promising Member
Thanks Mirek for your help. It works.
UPP is a powerful tool & platform especially for GUI development. Most examples and references are easy to be understood. Only one need is lack of a more completed developer's manual.

Best Regards,
Qinrong
Previous Topic: Loading Image into qtf
Next Topic: Random missing separating lines(V or H) in report table display
Goto Forum:
  


Current Time: Wed Apr 24 10:34:41 CEST 2024

Total time taken to generate the page: 0.01315 seconds