U++ framework
Do not panic. Ask here before giving up.

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: 218
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: 218
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 Apr 28 18:15:06 GMT+2 2026

Total time taken to generate the page: 0.00452 seconds