Concat via a rule

J

Jono

I have a set of text boxes that need to concatted in different combinations
depending on there values. In the text box that I want to do this I can enter
the concat in the Default Value formula area but when I try to employ a rule
to do it nothing happens.

I've tried just a simple rule like if field xx is not blank concat field xx
and field xx.

How can I accomplish the following?

If field466 = A and field462 = isblank then concat field466 and field464
If field466 = A and field462 = J or C then concat field 466 and field 462
If field466 = isblank concat field462 and field461
 
S

S.Y.M. Wong-A-Ton

You need to ask yourself first when you would like the rule to run. Is it
when you change the value of field466 for example? If so, put the rule on
field466 to set the value of the field holding the concatenation. You can
simulate the "IF...THEN" by using conditions on rules.

Hope this helps. If not, let me know what's still missing where information
is concerned.
 
J

Jono

Let me give some more detail. I have 5 text boxes 461, 462, 464, 466 and 467.

Field202 is a checkbox, when TRUE it sets field466 to A and field464 to U.

Field401 is an option button with three choices, when the value is 1 it sets
field462 to "" and field461 to "", when the value is 2, J and S, and when 3,
E and C.

In field467 I would like the following rules to apply anytime one of the
values in fields 461, 462, 464 or 466 changes.

If field466 = A and field462 = isblank then concat field466 and field464.
Result "AU"

If field466 = A and field462 = J or C then concat field 466 and field 462.
Result "AJ" or "AE"

If field466 = isblank concat field462 and field461. Result "JS" or "EC"

Now based on your response do I understand that changing the values of
fields 461, 462, 464 and 466 are not a trigger for the concatenation in 467.
I would need some other trigger like a checkbox being selected.
 
S

S.Y.M. Wong-A-Ton

No, you need to put the rules on the text boxes, but the logic is quite
complex and all will be trying to set the value of field 467, so things might
get messy.

Example for 1 rule:
If field466 = A and field462 = isblank then concat field466 and field464.
Result "AU"

Create the same rule on both field 466 and 462 as follows:
Action: Set a field's value, field 467, concat(field466, field464)
Condition: field466 is equal to A AND field462 is blank

To make sure that rules always fire, you can first use an action to set
their value to an empty string, and then a second one to set their value to
the real value. So for your 202 checkbox, you can create a rule that will set
466 first to an empty string, and then to an A. This will ensure that any
rules defined on 466 will always run. The reason for this is: If the value of
a field does not change, the rules defined on that field won't fire. By
emptying the field first, you force the rules on the field to fire.

If that does not work, you can always create a helperField that can evaluate
all the values of the text fields and set the value of 467 accordingly. You
can make the rule on this helperField fire at all times by creating 1 rule
with 2 actions on each of the other fields to set the value of the
helperfield to a string (e.g. "test") in the first action and then to an
empty string in the second action.

As usual, I'm giving you ideas on how to get things done and haven't tried
it out myself. If you get stuck, let me know, and I'll test it out quickly
for you.
 
J

Jono

Thanks, It took a liitle work but setting all the fields involved in a rule
to do the same thing was the key.

Rated
 

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