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.net/infopath2003/article.php?t=retrieve-field-
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,
>
[quoted text clipped - 76 lines]
> > > > > the Returned date being filled in the repeating table in order to change the
> > > > > 'Status' value to be 'Closed'?
Victor - 12 Mar 2007 06:21 GMT
Dear S.Y.M.Wong-A-Ton,
I managed to check the all the ReturnedDate have been filled in the
repeating tables and set the Status to Closed by creatign another field
called field 1. At helperField, i set three rules. Rule1 is i set the field's
value field=field1 and value=count(ReturnedDate[. = ""]),Rule 2, i set
Condition to field1=0 and Action is Status=Closed, Rule 3 i set Condition to
field1 > 0 and Action is Status='Active'. I can get the Status changed to
Closed after all the ReturnedDate have been filled in.
Now, i want to apply this control in the group's AfterChange event,
how do i loop through the group nodes to check if all the ReturrnedDate have
been filled in?
When i keyed in this
var nItemDesc;
if(eventObj.Source.parentNode)
{
nItemDesc=eventObj.Source.parentNode.selectSingleNode("../@ItemDesc").text;
}
in group's OnAfterchange event and run, ti says
'Object required'. What's wrong?
> 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,
[quoted text clipped - 100 lines]
> > > > > > the Returned date being filled in the repeating table in order to change the
> > > > > > 'Status' value to be 'Closed'?
Victor - 13 Mar 2007 08:31 GMT
Hi S.Y.M. Wong-A-Ton,
I have finally got my form running with the correct result that i want.
Thanks for your helps!
Regards,
Victor
> Dear S.Y.M.Wong-A-Ton,
>
[quoted text clipped - 131 lines]
> > > > > > > the Returned date being filled in the repeating table in order to change the
> > > > > > > 'Status' value to be 'Closed'?
S.Y.M. Wong-A-Ton - 19 Mar 2007 09:25 GMT
Glad you finally got it to work. And no worries. :)
---
S.Y.M. Wong-A-Ton
> Hi S.Y.M. Wong-A-Ton,
>
[quoted text clipped - 139 lines]
> > > > > > > > the Returned date being filled in the repeating table in order to change the
> > > > > > > > 'Status' value to be 'Closed'?