Search Problem

Hello to All. Good Work at all.
I’m a newbie in programming. :oops:

I am trying to obtain a Search to the how much difficult one, at least for me.

Then I have 3 tables:

Table A : Immobili; B Table : Demands; Table C : Sottorichieste

From a Form Demanded of the Table Demanded with correlated the Sottorichieste(campo Table “Common”) I would have to go in other Form Immobili(table Immobili)
where:

I would have to go in SERCH to insert the fields of the table Richietse (only one record)e all the Record Comuni (a lot of one) -of Sottorichieste Table.

If you can indicate the way to me, ve of I would be pleasing.

PS. As it is understood I do not very well chew instruction IF -DuplicaRecord-Loop so much…

I at least hope of to have been clear My Problem.

Code:

globals.glob_da_mq = forms.richieste0.da_mq
globals.glob_a_mq = forms.richieste0.a_mq
globals.glob_macrozona = forms.richieste0.macro_zona
//globals.glob_locaalita = forms.richieste0.localita
var test = globals.glob_da_mq
var test1 = globals.glob_a_mq
var test2 = globals.glob_macrozona
var variable = richieste_to_sottorichiesta.setSelectedIndex(1)
globals.glob_comune = richieste_to_sottorichiesta.comune
//(common == globals.glob_comune)
var common = globals.glob_comune
if (common == globals.glob_comune)

{
forms.immobili_2_SQL.controller.show()
forms.immobili_2_SQL.controller.find()
forms.immobili_2_SQL.localita = globals.glob_comune
forms.immobili_2_SQL.immobili_2_to_immobili_frazionam.capannone_p_t_totale_mq = globals.glob_da_mq + “” + globals.glob_a_mq

if (variable == richieste_to_sottorichiesta.getMaxRecordIndex())
{
controller.richieste_to_sottorichiesta.setSelectedIndex(1)
plugins.dialogs.showInfoDialog(’ Title’, ’ Value not allowed’, ’ OK’);
}
else
{
richieste_to_sottorichiesta.setSelectedIndex(variabile + 1)
forms.immobili_2_SQL.controller.newRecord()
forms.immobili_2_SQL.localita = globals.glob_comune
forms.immobili_2_SQL.immobili_2_to_immobili_frazionam.capannone_p_t_totale_mq = globals.glob_da_mq + “” + globals.glob_a_mq

}
}

Thanks however.

I can’t follow exactly what you are attempting to do. However, for a simple search, just do this:

//Start a find request, i.e. enter find mode
currentcontroller.find();

// set the values in the fields you want to search:
field = [some field or valuel];

//Start the database search and shows the results (returns number of rows), make sure you did ‘find()’ first!
var recordCount = currentcontroller.search();
//var recordCount = currentcontroller.search(false,false);//to extend foundset

bob cart:
var recordCount = currentcontroller.search();

A ‘heads up’ on this one. it only ‘counts’ the first 200 of a result set.
So if you find more than 200 then you still get the result of 200.
To get the full count of what you have found you use:

var recordCount = databaseManager.getFoundSetCount(foundset)

Ofcourse this can sometimes be an expensive operation.

Hi All,

FYI: Although the sample code says “this is an expensive operation” - it’s still very fast. I have tested on a table with 3 MILLION rows - and it’s instant.