Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 4th edition of the Campaign Community Lens newsletter is out now!
SOLVED

Predefined filter with form: Keep values when same attribute or xpath more than once

Avatar

Level 2

Hello

Here is a part of the form of the predefined filter “By age range”:

<form colcount="3">

<enter>

<set value="0" xpath="/tmp/@min"/>

<set value="0" xpath="/tmp/@max"/>

</enter>

<container colcount="2">

<input label="Minimum age" minValue="0" noTransaction="true" type="number" xpath="/tmp/@min"/>

<input label="Maximum age" minValue="0" noTransaction="true" type="number" xpath="/tmp/@max"/>

</container>

I did something similar with dates (minimum and maximum date). But if I use the “/temp/” path the inserted values are not kept when I later come back.

In contrast to this is the form of the predefined filter “By name or email”, where the values are kept when I come back later:

<form colcount="2">

<input noTransaction="true" xpath="@lastName"/>

<input noTransaction="true" xpath="@email"/>

</form>

But I can’t do it that way because in my case it would be something like:

<form colcount="2">

<input label="Minimum date of deliveries" noTransaction="true" type="datetime" xpath="execution/@broadStartDate"/>

<input label="Maximum date of deliveries" noTransaction="true" type="datetime" xpath="execution/@broadStartDate"/>

</form>

So the xpath for both input tags is the same ("execution/@broadStartDate"), and I see no way of dealing with it in the filter conditions of the General tab.

So: Is there a solution, where I can use the same attribute or xpath in the form of a predefined filter twice in a way that the inserted values are kept, so I can see them when later I come back?

Michael

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Michael,

Sorry you are right!

I was using as is for so long time that I thought it was off-the-shelf feature for age predefined filter.

So with a bit additional test, if you duplicate the factory filter on age to create a similar one withour the enter section, or your filter on broadStartDate, but without the enter section with values=0 initialisation, you won't lost the values entered by switching back and forth.

That works fine

Regards
J-Serge

0 Replies

Avatar

Community Advisor

Hi Michael,

Yes, it is an usual behavior; I think it is because age is a calculated element of the schema; so you loose the filter criteria cache when you leave the form.

Regards.
J-Serge

Avatar

Level 2

Hi Jean-Serge,

no, this is not the problem. It works even with age, if i do NOT use the path "/temp/" (the value is shown in the form also when I come back later, in a solution where I only use ONE age field).

But I do not find a way to do it without "/temp/", if there are 2 attributes or xpath of the same kind: be it 2 with "age" or in my special case 2 with "broadStartDate".

Michael

Avatar

Correct answer by
Community Advisor

Hi Michael,

Sorry you are right!

I was using as is for so long time that I thought it was off-the-shelf feature for age predefined filter.

So with a bit additional test, if you duplicate the factory filter on age to create a similar one withour the enter section, or your filter on broadStartDate, but without the enter section with values=0 initialisation, you won't lost the values entered by switching back and forth.

That works fine

Regards
J-Serge

Avatar

Level 2

Hi Jean-Serge

Thank you, it works.

Michael