Rules

E

Ed Thurber

Hello all:

hope someone can help me with this. I have an element that has a default
value of

count(../../../my:Header[msxsl:string-compare(my:Curr_Prj_Dts/my:pOC,
my:prom_Prj_dts/my:pOC) > 0 and my:prty <= 10 and my:Dev_Grp =
current()/../../my:Dev_Grp])

which sets the element to a count of items in a repeating group that meet a
certain criteria. This works fine.

There are also rules set up on this this element that state if the count = 0
then set the value in another element to somthing, and if the count > 0 to
set the value in the other element to something else. This also works.

I want to get rid of the first element and use rules on the second element
to set the value directly. I thought I could just paste the above equasion,
with the proper logical operator at the end, into the condition as an
expression and it would work.

count(../../../my:Header[msxsl:string-compare(my:Curr_Prj_Dts/my:pOC,
my:prom_Prj_dts/my:pOC) > 0 and my:prty <= 10 and my:Dev_Grp =
current()/../../my:Dev_Grp]) = 0

or

count(../../../my:Header[msxsl:string-compare(my:Curr_Prj_Dts/my:pOC,
my:prom_Prj_dts/my:pOC) > 0 and my:prty <= 10 and my:Dev_Grp =
current()/../../my:Dev_Grp]) > 0

It does not.

No errors thrown, just does not set the value.

Any trick to using expressions?

Ed
 
C

Clay Fox

You might need to rebuild your expression rather than pasting.
Another possibility is the context has changed. If you are using this now
within a repeating section then it will not see all rows of the data.

Often you need to do counts as you had it originially, in your form data, so
that it can see across all records. Otherwise you need to bind to the
repeating group rather than a particular field so that you can get across all
records.
 
E

Ed Thurber

Clay:

Thanks for the reply. An interesting solution that I had not thought of.
Please let me rephrase and let me know if I am understanding you.

Instead of placing the rules on the second element, place them on the group
that I am counting (my:Header)?

Ed

Clay Fox said:
You might need to rebuild your expression rather than pasting.
Another possibility is the context has changed. If you are using this now
within a repeating section then it will not see all rows of the data.

Often you need to do counts as you had it originially, in your form data,
so
that it can see across all records. Otherwise you need to bind to the
repeating group rather than a particular field so that you can get across
all
records.
--
Clay Fox / Microsoft InfoPath MVP
www.InfoPathDev.com / The InfoPath Authority / Downloads, Samples, How-To,
Experts, Forum


Ed Thurber said:
Hello all:

hope someone can help me with this. I have an element that has a default
value of

count(../../../my:Header[msxsl:string-compare(my:Curr_Prj_Dts/my:pOC,
my:prom_Prj_dts/my:pOC) > 0 and my:prty <= 10 and my:Dev_Grp =
current()/../../my:Dev_Grp])

which sets the element to a count of items in a repeating group that meet
a
certain criteria. This works fine.

There are also rules set up on this this element that state if the count
= 0
then set the value in another element to somthing, and if the count > 0
to
set the value in the other element to something else. This also works.

I want to get rid of the first element and use rules on the second
element
to set the value directly. I thought I could just paste the above
equasion,
with the proper logical operator at the end, into the condition as an
expression and it would work.

count(../../../my:Header[msxsl:string-compare(my:Curr_Prj_Dts/my:pOC,
my:prom_Prj_dts/my:pOC) > 0 and my:prty <= 10 and my:Dev_Grp =
current()/../../my:Dev_Grp]) = 0

or

count(../../../my:Header[msxsl:string-compare(my:Curr_Prj_Dts/my:pOC,
my:prom_Prj_dts/my:pOC) > 0 and my:prty <= 10 and my:Dev_Grp =
current()/../../my:Dev_Grp]) > 0

It does not.

No errors thrown, just does not set the value.

Any trick to using expressions?

Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top