If you only have one row and you fill in the returned date, the status would
change immediately to Closed. After you add another row with an empty date,
it should change again to Active
If you want to make the Status change to Closed only after all the rows'
returned date have been filled in for the first time, you'll have to write
code. You will need to add an extra field in the repeating table to keep
track of whether a date was once filled in already or not. Then in the
OnAfterChange event of the date field write code to set the extra field
whenever the extra field is empty and the date field is not empty. This code
should only set the extra field in the same row as the date field. Once
you've got that, you can write more code in the OnAfterChange of the date
field to loop through all the rows of the repeating table, checking whether
the extra fields in all rows have been filled in and setting the status field
accordingly.
Do a search in this newsgroup on "repeating table loop" to find code
snippets on how to loop through a repeating table. And the same way you can
retrieve a value of another field in the same row as a field (see
http://enterprise-solutions.swits.n...value-same-row-repeating-table&c=infopath2003),
you can set the value of another field in the same row as a field.
---
S.Y.M. Wong-A-Ton
:
Hi S.Y.M.Wong-A-Ton,
Really, the first time i filled in the returned date in the repeating
table's frist row, the Status immediately changed to Closed before i finished
filling all the rows' returned date. But after that i removed all the rows'
returned date and fill in again, the Status will only change to Closed after
i have filled in all the rows' returned date whcih is the correct way.
I wonder how to make the Status change to Closed only after all the
rows' returned date have been filled in for the first time?
Secondly, i want to ask for Condition on rule 1
count(../my:group1/my:group2/my:returnedDate[text ()=""]) = 0
I used 'the expression' to put this coding, right?
Regards,
Victor
:
You need to add an Action that sets the value of helperField to the text
"action". The text "action" can also be something else like
"whateveryouwant". It does not really matter. Just set the value of
helperField to something other than an empty string and it should work.
---
S.Y.M. Wong-A-Ton
:
Sorry S.Y.M. Wong-A-Ton,
I don't understand with this sentence : Set a field's value:
helperField = "action"
What is this "action" referred to? I think maybe my earlier question has
something to do with this.
Thanks & Regards,
Victor
:
You could use code, but you can also do it using rules and conditions. Here's
how:
1. Create a helperField in your Main data source.
2. Add 1 rule on the Returned date field in your repeating table with 2
actions that say:
Set a field's value: helperField = ""
Set a field's value: helperField = "action"
3. Add 2 rules to the helperField:
Rule 1: Set a field's value: status = "Closed"
Condition on rule 1:
count(../my:group1/my:group2/my:returnedDate[text()=""]) = 0
where my:returnedDate is your Returned date field in your repeating table.
Correct the XPath expression to suit your form template's data source
structure. status is your Status field.
Rule 2: Set a field's value: status = "Active"
Condition on rule 2:
count(../my:group1/my:group2/my:returnedDate[text()=""]) != 0
---
S.Y.M. Wong-A-Ton
:
Hi, i have a problem like this:
I have a form that keeps track of the equipments held by employees. The form
records equipments' issue date, Item, Category and a Returned date in a
repeating table. I also have a field outside the repeating table called
'Status' to indicate if all the equipments have been returned. If all
equipments have been returned, the 'Status' value will be 'Closed' and
likewise, if one of the equipments not returned, the 'Status' value will be
'Active'. The 'Status' is determined by all the equipments' Returned date
being filled.
I can insert many equipments in the repeating table.How to loop through all
the Returned date being filled in the repeating table in order to change the
'Status' value to be 'Closed'?