Home » U++ Library support » TreeCtrl » off by 1 dynamic tree with sql: SOLVED
off by 1 dynamic tree with sql: SOLVED [message #53714] |
Fri, 24 April 2020 02:12 |
|
Hi all-
TIA
I go to draw the tree and I am off by one using postgres. If you have a second, can you see if something jumps off the page? I think it has something to do with the root. I'd like to change tree and create a branch for parent every time it encounters a master GL account.
It gives a result like :
basket weaving
-> auto
-> gas
-> maint
instead of
auto
-> gas
-> maint
PromptOK(" Lets go ");
VectorMap<String,int> vm;
Vector<int> v4;
Sql sql(m3_session);
sql.Clear();
int y = 0;
int n, n1 = 1;
sql.SetStatement("SELECT DISTINCT PFIELD, COUNT(*) from accounts GROUP BY GROUPING SETS (PFIELD) ");
sql.Execute();
while (sql.Fetch()) {
vm.Add(sql[0],sql[1]);
PromptOK(sql[0].ToString());
}
for (auto a: vm)
PromptOK(AsString(vm.GetCount()));
sql.SetStatement(Select(ACCTNUM, ACCTNAME).From(ACCOUNTS).OrderBy(ACCTNUM));
sql.Execute();
while (sql.Fetch()){
if ( vm.Find(sql[0])==1){
optree.Add(y, AsString(sql[1]));
PromptOK("okay");
// PromptOK(AsString(n));
} else {
optree.Add(0 , AsString(sql[1]));
}
++n;
++y;
}
PromptOK("Lets stop");
}
hI ALL AGAIN-
I think the chart of accounts are string and I was thinking it would sort it in number format. That is the bug. At least I hope so. I can figure that out if that is all that is going on. Thanks.
[Updated on: Fri, 24 April 2020 02:51] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat May 04 11:46:34 CEST 2024
Total time taken to generate the page: 0.02341 seconds
|