I need to have a layout that shows grouped information.
Serial ID Data
1 PASS
1 PASS
1 PASS
1 PASS
1 PASS
2 FAIL
2 FAIL
2 FAIL
2 FAIL
2 FAIL
Is it possible to just show 2 rows?
Serial ID DATA
1 PASS
2 FAIL
I need to have a layout that shows grouped information.
Serial ID Data
1 PASS
1 PASS
1 PASS
1 PASS
1 PASS
2 FAIL
2 FAIL
2 FAIL
2 FAIL
2 FAIL
Is it possible to just show 2 rows?
Serial ID DATA
1 PASS
2 FAIL
You could load the form with a custom query.
From the top of my head…:
var query = 'select id from table where condition=? group by column1, column2 order by column1;';
var ds = databaseManager.getDataSetByQuery(controller.getServerName(), query, [yourCondition], 1000);
controller.loadRecords(ds);
Hope this helps.
ROCLASI:
You could load the form with a custom query.From the top of my head…:
var query = 'select id from table where condition=? group by column1, column2 order by column1;';
var ds = databaseManager.getDataSetByQuery(controller.getServerName(), query, [yourCondition], 1000);
controller.loadRecords(ds);
Hope this helps.
Thanks for alwasy getting back to my questions so quickly. When you say load a form with custom query, do i have to create a new form, leave it blank? then somehow attach the query to the form? I’m not clear how this work…
You can use the form you are using now.
By using this code (ofcourse it’s pseudo code so adjust it to your needs) you load the data in that form.
Kinda like controller.loadAllRecords() will load all data from that table.
Hope this helps.
ROCLASI:
You can use the form you are using now.
By using this code (ofcourse it’s pseudo code so adjust it to your needs) you load the data in that form.
Kinda like controller.loadAllRecords() will load all data from that table.Hope this helps.
This is the first time i used the getDataSetByQuery and it’s acting so wierd.
I do a simple query such as “select serial_no from table1 where lotnum=10001” yet it pulls up multiple lot #s, other than 10001. It’s as if the SQL commands doesn’t even work. i followed the same syntax as below. But, if i do just "select * from table1 where lot_num=10001, the queries come out correct.
Does it have something to do with what fields i place on the existing form? or does the SQL query execute regardless of what fields I put in the form?
Please help.
thanks,
var query = ‘select id from table where condition=? group by column1, column2 order by column1;’;
var ds = databaseManager.getDataSetByQuery(controller.getServerName(), query, [yourCondition], 1000);
controller.loadRecords(ds);
sammyzheng:
This is the first time i used the getDataSetByQuery and it’s acting so wierd.I do a simple query such as “select serial_no from table1 where lotnum=10001” yet it pulls up multiple lot #s, other than 10001. It’s as if the SQL commands doesn’t even work. i followed the same syntax as below. But, if i do just "select * from table1 where lot_num=10001, the queries come out correct.
You do need to do the GROUP BY which I put in the example.
The GROUP BY does the magic.
Also make sure you do the ORDER BY. Servoy kinda requires it.
To test your query put it in iSQL (if you use Sybase) or your favorite query tool so you know that the SQL works or not.
sammyzheng:
Does it have something to do with what fields i place on the existing form? or does the SQL query execute regardless of what fields I put in the form?
You only select the primary key in the query so Servoy can load that foundset. Then it can show any field of the table so it doesn’t matter what field you put on the form.
Hope this helps
ROCLASI:
sammyzheng:
This is the first time i used the getDataSetByQuery and it’s acting so wierd.I do a simple query such as “select serial_no from table1 where lotnum=10001” yet it pulls up multiple lot #s, other than 10001. It’s as if the SQL commands doesn’t even work. i followed the same syntax as below. But, if i do just "select * from table1 where lot_num=10001, the queries come out correct.
You do need to do the GROUP BY which I put in the example.
The GROUP BY does the magic.
Also make sure you do the ORDER BY. Servoy kinda requires it.To test your query put it in iSQL (if you use Sybase) or your favorite query tool so you know that the SQL works or not.
sammyzheng:
Does it have something to do with what fields i place on the existing form? or does the SQL query execute regardless of what fields I put in the form?You only select the primary key in the query so Servoy can load that foundset. Then it can show any field of the table so it doesn’t matter what field you put on the form.
Hope this helps
Darn, it’s still not working. The funny thing is, i’m on SQL server and query works perfect on SQL server, but when i try to execute it on Servoy, it’s not working. I’m even doing something super simple.
What works is :
select * from table1 where lot_no = 1001
But once i put select serial_no from table1 where lot_no = 1001, that’s why it pulls lot_no’s 1001, 1003,1005. WEIRD
Can you show me the complete method you use to load the data ?
ROCLASI:
Can you show me the complete method you use to load the data ?
//var query = ‘select serial_no, min(pass_fail1), min(pass_fail2), min(pass_fail3) from dimension where lot_num = ’ + globals.g_main_lot_num + ’ group by serial_no order by serial_no’
var query = "select serial_no from dimension where lot_num = " + globals.g_main_lot_num + " "
globals.zgtest1 = query
var ds = databaseManager.getDataSetByQuery(controller.getServerName(),query,null,1000);
controller.loadRecords(ds);
in Query Analyzer, the first //var query works perfectly. But doing that in servoy cuases really wierd results. I’m hoping someone in Servoy world can figure this issue out for me.
With Robert and Maarten’s help I have almost achieved what I want.
I have attached a solution.
Import it.
Open it.
The form ''media_application_tab_swapping" contains 3 basic features:
This has a relationship:
media_application.media_application_id=media.foreign_key
and
media_application.table_name=media.foreign_table
Now, when the solution is opened, the portal and the found set in the _BlueForm inserted in the tab-panel are ‘in-sync’. As you click on a portal row, the _BlueForm record selection is updated; as you navigate _BlueForm, the portal row selection is updated.
Now click ‘swap form in tab pane’.
Select _BlueForm.
The series of methods invoked here can be easily traced starting with the global method ‘selectDemo_form_swapping’ (only global methods are used here).
Now, however, navigation events in the _Blue(or _Green)Form do not update the portal; and like wise, portal row selection does not navigate the embedded form.
How do I maintain this ‘sync’ behaviour.
Obviously it has something to do with the found set, but I can’t figure it out.
cheers
J
Did you get my last mail Julian. (17 Oct)
I made a suggestion in there, how to keep stuff in sync
but I didn’t get a reply.