Grid--> Start by search--> Hide field

Hi!

I have a grid which starts by Search. In Search i need to hide field using a variable…

I used the following code in event onScriptInit (in the search part of the grid)

if ([somevar] == ‘somevalue’)
{
sc_field_display({Type}, ‘off’);
}
else
{
sc_field_display({Type}, ‘on’);
}

and it is not hiding the field…

I have tried the same code in the grid part and it is working there…hides the field

am i putting the code in the wrong event? or am i missing something?

Thanks!

Re: Grid–> Start by search–> Hide field

check at the manual if this function works on search …

Re: Grid–> Start by search–> Hide field

Well, in manual under Grid application–>search–>events it says,

OnInit - This event is executed just one time, before the main select of the application execution. In this scope, normally, are executed the macros that update the select, as these: sc_select_field, sc_select_order, sc_select_where(add) and etc.

Also tried to put the fields in the blocks and hide block instead…didn’t work

Thanks for your reply anyway…

Re: Grid–> Start by search–> Hide field

onInit ok, but sc_field_display applys only to grid application, not search.

Re: Grid–> Start by search–> Hide field

Alright, I give up.

Thanks for your help.