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 » U++ SQL » Program changing column
Program changing column [message #54979] Sat, 03 October 2020 08:22 Go to next message
jimlef is currently offline  jimlef
Messages: 90
Registered: September 2020
Location: US
Member
I have sqlarray, and wish to either have (ID, "ID") or (NAME, "Name") dependent upon checkbox.

I have figured out some code to tell when option changes state:
anon.WhenAction << THISBACK(anonChanged);
.
.
.
void TaxWindow::anonChanged()
{
	if (anon.Get() == 1) // s/b 1 = true/checked, 0 for unchecked I believe
		// use Number
		return;
	else // use name
		return;
}


But am at a complete loss how best (or even just how) to accomplish this? Ultimately, will use AsQTF to output a table from array...

Thank you!

Jim
Re: Program changing column [message #54993 is a reply to message #54979] Sun, 04 October 2020 07:13 Go to previous messageGo to next message
jimlef is currently offline  jimlef
Messages: 90
Registered: September 2020
Location: US
Member
I'm still working on this, but so far all I've come up with is to change column widths to "cover up" unwanted column:
void TaxWindow::anonChanged()
{
	if (anon.Get() == 1) {
		// use cust Number
		 sqlTaxReport.ColumnWidths("150 200 [u]65 1[/u] 150 150 150 200 200");
		return;
	}
	else  {// use cust name
		sqlTaxReport.ColumnWidths("150 200 [u]1 140[/u] 150 150 150 200 200");
		return;
	}
		
}


I'm probably going to eliminate the array altogether, though, once I figure out the way to use repgen (or an alternative) with the current stable build...
Re: Program changing column [message #54994 is a reply to message #54993] Sun, 04 October 2020 09:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13990
Registered: November 2005
Ultimate Member
ColumnWidths is really mostly for initial setup (btw, there is a little trick: if you ctrl-click the table header in debug mode, U++ will store ColumnWidth code on the clipboard. That way you can setup it in running application and then move values easily into your source code).

You can use HeaderTab(i) to get into setting of header and then Show or Hide... Something like

sqlTaxReport.HeaderTab(2).Show(annon.Get() == 1);
sqlTaxReport.HeaderTab(3).Show(annon.Get() != 1);


Mirek
Re: Program changing column [message #55002 is a reply to message #54979] Sun, 04 October 2020 15:32 Go to previous message
jimlef is currently offline  jimlef
Messages: 90
Registered: September 2020
Location: US
Member
That's Perfect! Does that carry over when exporting to csv or qtf though? I'll have to see!

Thank you again!
Previous Topic: sqlite and dropdate / editdate etc
Next Topic: Changing Database [Solved]
Goto Forum:
  


Current Time: Tue Jul 16 04:32:08 CEST 2024

Total time taken to generate the page: 0.02099 seconds