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 » Community » Newbie corner » Calculated column in a SqlArray
Calculated column in a SqlArray [message #49747] Thu, 19 April 2018 17:58 Go to next message
Giorgio is currently offline  Giorgio
Messages: 170
Registered: August 2015
Experienced Member
Hi there,
in a SqlArray I need to add a column that contains a simple calculation from two other columns, something like this:

...
        //lstSamples is the SqlArray control
	lstSamples.AddColumn(TOTSAMPLES, t_("Tot number of samples collected"), 10).SetFormat("%2!,n");
	lstSamples.AddColumn(GOODSAMPLES, t_("Good samples collected"), 10).SetFormat("%2!,n");
	lstSamples.AddColumn(([GOODSAMPLES]/[TOTSAMPLES]), t_("Percentage"), 10).SetFormat("%2!,n");
...


but of course [GOODSAMPLES]/[TOTSAMPLES] does not work.
is there a way to do that?
Thankls,
gio
Re: Calculated column in a SqlArray [message #49748 is a reply to message #49747] Thu, 19 April 2018 18:05 Go to previous message
Giorgio is currently offline  Giorgio
Messages: 170
Registered: August 2015
Experienced Member
Oh boy, it was so simple Very Happy

SqlId percentage("GOODSAMPLES/TOTSAMPLES");
...
	lstSamples.AddColumn(TOTSAMPLES, t_("Tot number of samples collected"), 10).SetFormat("%2!,n");
	lstSamples.AddColumn(GOODSAMPLES, t_("Good samples collected"), 10).SetFormat("%2!,n");
	lstSamples.AddColumn(percentage, t_("Percentage"), 10).SetFormat("%2!,n"); 
...
Previous Topic: linking has failed
Next Topic: Building for Windows XP sp3
Goto Forum:
  


Current Time: Tue Feb 19 09:35:45 CET 2019

Total time taken to generate the page: 0.00651 seconds