Re: [QGIS-Developer] Question on current_value() expression in the context of filtering relation reference combo boxes

2022-12-06 Thread Andreas Neumann via QGIS-Developer

Hi Ale,

That would explain it ;-)

I also tried various other combinations, like

with @current_parent_feature, @feature, etc. - but haven't found a 
working version ...


I might try with a variable ;-) I got the variable filter version 
working in another project. But that involved Python ...


Andreas

On 2022-12-06 16:52, Alessandro Pasotti wrote:


Sorry, I just realized that you are using relation-reference widgets
and not value-relation widgets.

I don't think that the current_(parent)_value will work in that case,
it wasn't implemented.

Cheers

On Tue, Dec 6, 2022 at 3:59 PM Andreas Neumann via QGIS-Developer
 wrote:


Hi,

In one of my form setups,  I would like to filter one relation 
reference widget combo box with a filter expression based on the 
selected entry of another relation reference value.


A static filter like:

szenario_art = 'Brand'

works as expected and it returns the filtered values - but as soon as 
I try to base it on the value of another relation reference widget, it 
fails ...


I tried

szenario_art = current_value('szenario_art')

but no records get selected.

Questions:

Does the current_value() return the "internal value" or the "human 
readable" value?

Do I have to eval() something in the filter expression?
Is there a way to test "current_value" somehow? I tried to write the 
changed value into another text widget (with default values on 
update), but it will always return "NULL". In the expression editor, I 
also always get "NULL" in the preview.


Thank you for your help,

Andreas

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Question on current_value() expression in the context of filtering relation reference combo boxes

2022-12-06 Thread Alessandro Pasotti via QGIS-Developer
Sorry, I just realized that you are using relation-reference widgets
and not value-relation widgets.

I don't think that the current_(parent)_value will work in that case,
it wasn't implemented.

Cheers

On Tue, Dec 6, 2022 at 3:59 PM Andreas Neumann via QGIS-Developer
 wrote:
>
> Hi,
>
> In one of my form setups,  I would like to filter one relation reference 
> widget combo box with a filter expression based on the selected entry of 
> another relation reference value.
>
> A static filter like:
>
> szenario_art = 'Brand'
>
> works as expected and it returns the filtered values - but as soon as I try 
> to base it on the value of another relation reference widget, it fails ...
>
> I tried
>
> szenario_art = current_value('szenario_art')
>
> but no records get selected.
>
>
> Questions:
>
> Does the current_value() return the "internal value" or the "human readable" 
> value?
> Do I have to eval() something in the filter expression?
> Is there a way to test "current_value" somehow? I tried to write the changed 
> value into another text widget (with default values on update), but it will 
> always return "NULL". In the expression editor, I also always get "NULL" in 
> the preview.
>
> Thank you for your help,
>
> Andreas
>
>
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Question on current_value() expression in the context of filtering relation reference combo boxes

2022-12-06 Thread Alessandro Pasotti via QGIS-Developer
You probably need to use current_parent_value() to get the value of
the "parent" form in case of embedded sub-forms.

On Tue, Dec 6, 2022 at 4:34 PM Andreas Neumann  wrote:
>
> Hi Ale,
>
> Thanks for your information.
>
> What if both tables have the same column names? Would that also work?
>
> In my case the related table contains a field called "szenario_art" and the 
> parent table also has the same field name.
>
> Can one assume that a field left of the operator will be in the related table 
> while fields right of the operator are in the parent table? Or how would the 
> expression distinguish the fields if they appear in both tables?
>
> Thanks,
> Andreas
>
> On 2022-12-06 16:29, Alessandro Pasotti wrote:
>
> On Tue, Dec 6, 2022 at 3:59 PM Andreas Neumann via QGIS-Developer
>  wrote:
>
>
> Hi,
>
> In one of my form setups,  I would like to filter one relation reference 
> widget combo box with a filter expression based on the selected entry of 
> another relation reference value.
>
> A static filter like:
>
> szenario_art = 'Brand'
>
> works as expected and it returns the filtered values - but as soon as I try 
> to base it on the value of another relation reference widget, it fails ...
>
> I tried
>
> szenario_art = current_value('szenario_art')
>
> but no records get selected.
>
>
> Questions:
>
> Does the current_value() return the "internal value" or the "human readable" 
> value?
>
>
> The internal value.
>
> Do I have to eval() something in the filter expression?
>
>
> No.
>
> Is there a way to test "current_value" somehow? I tried to write the changed 
> value into another text widget (with default values on update), but it will 
> always return "NULL". In the expression editor, I also always get "NULL" in 
> the preview.
>
>
> That should work, the current_value returns the current value of the
> feature being edited in the context of the form, this includes any
> change that took place in the form.
>
> You might get null values in the editor and the preview because there
> is no form context in that case.
>
>
>
>


-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Question on current_value() expression in the context of filtering relation reference combo boxes

2022-12-06 Thread Andreas Neumann via QGIS-Developer

Hi Ale,

Thanks for your information.

What if both tables have the same column names? Would that also work?

In my case the related table contains a field called "szenario_art" and 
the parent table also has the same field name.


Can one assume that a field left of the operator will be in the related 
table while fields right of the operator are in the parent table? Or how 
would the expression distinguish the fields if they appear in both 
tables?


Thanks,
Andreas

On 2022-12-06 16:29, Alessandro Pasotti wrote:


On Tue, Dec 6, 2022 at 3:59 PM Andreas Neumann via QGIS-Developer
 wrote:


Hi,

In one of my form setups,  I would like to filter one relation 
reference widget combo box with a filter expression based on the 
selected entry of another relation reference value.


A static filter like:

szenario_art = 'Brand'

works as expected and it returns the filtered values - but as soon as 
I try to base it on the value of another relation reference widget, it 
fails ...


I tried

szenario_art = current_value('szenario_art')

but no records get selected.

Questions:

Does the current_value() return the "internal value" or the "human 
readable" value?


The internal value.


Do I have to eval() something in the filter expression?


No.

Is there a way to test "current_value" somehow? I tried to write the 
changed value into another text widget (with default values on 
update), but it will always return "NULL". In the expression editor, I 
also always get "NULL" in the preview.


That should work, the current_value returns the current value of the
feature being edited in the context of the form, this includes any
change that took place in the form.

You might get null values in the editor and the preview because there
is no form context in that case.___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Question on current_value() expression in the context of filtering relation reference combo boxes

2022-12-06 Thread Alessandro Pasotti via QGIS-Developer
On Tue, Dec 6, 2022 at 3:59 PM Andreas Neumann via QGIS-Developer
 wrote:
>
> Hi,
>
> In one of my form setups,  I would like to filter one relation reference 
> widget combo box with a filter expression based on the selected entry of 
> another relation reference value.
>
> A static filter like:
>
> szenario_art = 'Brand'
>
> works as expected and it returns the filtered values - but as soon as I try 
> to base it on the value of another relation reference widget, it fails ...
>
> I tried
>
> szenario_art = current_value('szenario_art')
>
> but no records get selected.
>
>
> Questions:
>
> Does the current_value() return the "internal value" or the "human readable" 
> value?

The internal value.

> Do I have to eval() something in the filter expression?

No.

> Is there a way to test "current_value" somehow? I tried to write the changed 
> value into another text widget (with default values on update), but it will 
> always return "NULL". In the expression editor, I also always get "NULL" in 
> the preview.

That should work, the current_value returns the current value of the
feature being edited in the context of the form, this includes any
change that took place in the form.

You might get null values in the editor and the preview because there
is no form context in that case.




-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] Question on current_value() expression in the context of filtering relation reference combo boxes

2022-12-06 Thread Andreas Neumann via QGIS-Developer

Hi,

In one of my form setups,  I would like to filter one relation reference 
widget combo box with a filter expression based on the selected entry of 
another relation reference value.


A static filter like:

szenario_art = 'Brand'

works as expected and it returns the filtered values - but as soon as I 
try to base it on the value of another relation reference widget, it 
fails ...


I tried

szenario_art = current_value('szenario_art')

but no records get selected.

Questions:

 	* Does the current_value() return the "internal value" or the "human 
readable" value?

* Do I have to eval() something in the filter expression?
 	* Is there a way to test "current_value" somehow? I tried to write the 
changed value into another text widget (with default values on update), 
but it will always return "NULL". In the expression editor, I also 
always get "NULL" in the preview.


Thank you for your help,

Andreas___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer