Page 1 of 1

Lookup field Add page filter

Posted: Thu Nov 24, 2022 9:02 pm
by covecove1

Hello,

I am trying to hide options from select list which are already present in that table,
and it's working fine:

Filter:
"f_function(`id`) = 0"

However,
that filter hides name in List page and I can only see ID in that column.

When I try to use function only on add page it's not working:

CurrentPageID() == 'list' || ("f_function(`id`) = 0" && CurrentPageID() == 'add')

Please help, how can I limit lookup field in filter with my db function only in Add page,
but keep column correct in list page.

Thanks!


Re: Lookup field Add page filter, please help

Posted: Thu Nov 24, 2022 9:56 pm
by mobhar

Just remove this part:

CurrentPageID() == 'list' ||


Re: Lookup field Add page filter, please help

Posted: Thu Nov 24, 2022 10:08 pm
by covecove1

mobhar wrote:

Just remove this part:

CurrentPageID() == 'list' ||

i tried that before and now. filter is not removing options from list when i write it like
("f_function('id') = 0" && CurrentPageID() == 'add')

but if i write
"f_function('id') = 0"
then filter is removing options as it should in Add page.

pls help, thanks!


Re: Lookup field Add page filter

Posted: Thu Nov 24, 2022 10:13 pm
by arbei

You may try:

CurrentPageID() == "add" ? "f_function(`id`) = 0" : ""


Re: Lookup field Add page filter

Posted: Thu Nov 24, 2022 10:25 pm
by covecove1

arbei wrote:

You may try:

CurrentPageID() == "add" ? "f_function(`id`) = 0" :
""

Your solution is working, thank youuu!

Can you explain why my filter "f_function('id') = 0" && CurrentPageID() == "add" is not working?


Re: Lookup field Add page filter

Posted: Fri Nov 25, 2022 8:07 am
by mobhar

covecove1 wrote:

Can you explain why my filter "f_function('id') = 0" && CurrentPageID() == "add" is not working?

Because you include the function in the if condition block, and not in execution block.