TOPIC: Have a trouble with a Control
#343
Have a trouble with a Control 3 Years, 12 Months ago
Hi to all

I have a trouble with a Control...

I've got a table named 'Presupuestos' and the following columns are on it:

Field_cod_presup
Code:


Field_date_time
{
Prompt: 'Presupuesto'
Control: (Field width: 15 justify: 'CENTER' readonly: true)

}


Field_lista_prep
Code:


Field_String
{
Prompt: 'Presupuesto N? '
Control: (ChooseList  , width: 13)

}


...and a Rule...
Rule_lista_prep
Code:


function ()

{

return (ChooseListControl( QueryList("Presupuestos ", "cod_presup")
width: 13  )
)

}



This Rule works fine, but when I try to use it on a Control or in a Layout occurs an error: "Unknown method: Boolean.Size".

ElegirPresupuestoControl
Code:


Controller
{

Controls:
(
Vert(

Horz( Center(Border(lista_prep) , border: 20
))

)
)

}



Any sugestion?

Thanks.

Luis Alfredo Barrasa
Spain
 
 
#348
Re:Have a trouble with a Control 3 Years, 12 Months ago
Hi Luis,

One concern is that you are using a Field control with date/time values. This probably won't give the results you need.

If I understand what you are trying to do, Rule_lista_prep should simply return the list:

Code:

Rule_lista_prep

function ()
    {
    return QueryList("Presupuestos ", "cod_presup")
    }



And your Control should specify: listField: lista_prep

Note: Rules should not interact with the user and should not even have any "side effects". They should be functional i.e. simply return a result possibly based on other fields. (queries are ok)

Hope that helps!
 
 
andrew
 
#351
Re:Have a trouble with a Control 3 Years, 11 Months ago
Hi Andrew.

I just need a Control that select a value of the cod_presup field and then use it in the Query of an Access.

Something like this should be enough, but gives two errors:
"can't convert String to number" and "uninitialized member: #Controller_redir"

Code:


Controller
{
Controls:
(
ChooseList(listField: QueryList("Presupuestos ", "cod_presup"))

// Here goes the Access filtered with the ChooseList result.
)
}



Something more... How could I use the result of the ChooseList to create the Access?.

Thanks.

Luis Alfredo Barrasa
Spain
 
 
#352
Re:Have a trouble with a Control 3 Years, 11 Months ago
Sorry, I am not sure I understand what you are trying to do.

For ChooseList listField must be the name of a field that contains the list of values. This is usually done by using a rule. It has to look like this:

Code:

Control: (ChooseList listField: my_list_rule)


Notice the location of the parenthesis.

Then you would have a rule that returns the list:

Code:

Rule_my_list_rule

function ()
    {
    list = ...
    return list
    }



Do you want to open a second Access or do you want to filter the Access that you are on?
 
 
andrew