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 » TreeCtrl » off by 1 dynamic tree with sql: SOLVED
Re: off by 1 dynamic tree with sql: SOLVED [message #53732 is a reply to message #53714] Sat, 25 April 2020 01:58 Go to previous message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-

I just thought I'd share how I drew the tree with my chart of accounts...
thnx for all the cool help here. I'm working on making a very small budgeting application.
roboloki

void MyMain::RunSQL(){
	
	Sql sql(m3_session);
	sql.Clear();

	int y = -0;	
	int n = 0; 
	int n1 = 1;
	String mystr;

	sql.SetStatement("SELECT DISTINCT PFIELD, COUNT(*)  from accounts GROUP BY GROUPING SETS (PFIELD) order by pfield");
	sql.Execute();
	while (sql.Fetch()) {
		
		mystr=sql[0];
		if (mystr.Find('*') != -1){	
		
	
	    vm.Add(sql[0],sql[1]);
	   // PromptOK(sql[0].ToString());
		}
	



}
		

}


void MyMain::SlingTv() {
	
	int n = 0; 
	int n1 = 0;
	String mystr;
	
	Sql sql(m3_session);
	sql.Clear();

	
	sql.SetStatement(Select(PFIELD,ACCTNUM, ACCTNAME).From(ACCOUNTS).OrderBy(ACCTNUM));
	sql.Execute();
	while (sql.Fetch()){
		
		mystr=sql[0];
		if (  mystr.Find('*') != -1){
			//PromptOK(AsString(n1));
				optree.Add(0, sql[2].ToString());				
		
			
		} 
	}
		
	
	sql.SetStatement(Select(PFIELD,ACCTNUM, ACCTNAME).From(ACCOUNTS).OrderBy(ACCTNUM));
	sql.Execute();
	while (sql.Fetch()){
		
		mystr=sql[0];
		if (  mystr.Find('*') != -1){
			//PromptOK(AsString(n1));
			
		
		n1 = 0;				
		PromptOK(AsString(n)+":n");
		++n;
		continue;
			
		} else {
		optree.Insert(n,n1,sql[2].ToString());
		n1++;;
		PromptOK(AsString(n1 )+":n1");
		}
		

	}
	
//	optree.Insert(5,0,"foo");
//	optree.Insert(5,1,"foo2");
   		
	//	optree.Add( 

}
 
Read Message
Read Message
Previous Topic: Drag&drop example bug and questions
Next Topic: Iterate over all nodes
Goto Forum:
  


Current Time: Mon Aug 25 22:11:13 CEST 2025

Total time taken to generate the page: 0.05142 seconds