How to change a control's value by checking fields in repeating ta

V

Victor

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'?
 
S

S.Y.M. Wong-A-Ton

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
 
V

Victor

Hi S.Y.M. Wong-A-Ton,

First of all, i want to say a million thanks to you for posting the
solutions to me. It really works!

But there is one problem which when after I have keyed in let's say two
equipments in the repeating table with the returnedDate not filled in. Then
we go and fill in the returnedDate. When i fill in the first row's
returnedDate field, the Status immediately changed to 'Closed' before i fill
in the second row. But after i remove the both's returnedDate value and fill
in again the returnedDate, i must fill in two rows' returnedDate value, then
the Status will change to 'Closed' whcih is the correct way.

How come the first time when i fill in the returnedDate, the Status
automatically changed to 'Closed' without waiting for the second row of the
returnedDate field being filled in.

Thank you for your helps!

Regards,
Victor

S.Y.M. Wong-A-Ton said:
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


Victor said:
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'?
 
V

Victor

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



S.Y.M. Wong-A-Ton said:
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


Victor said:
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'?
 
S

S.Y.M. Wong-A-Ton

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


Victor said:
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



S.Y.M. Wong-A-Ton said:
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


Victor said:
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'?
 
V

Victor

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

S.Y.M. Wong-A-Ton said:
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


Victor said:
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



S.Y.M. Wong-A-Ton said:
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'?
 
S

S.Y.M. Wong-A-Ton

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


Victor said:
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

S.Y.M. Wong-A-Ton said:
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


Victor said:
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'?
 
V

Victor

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?





S.Y.M. Wong-A-Ton said:
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


Victor said:
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

S.Y.M. Wong-A-Ton said:
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'?
 
V

Victor

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

Victor said:
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?





S.Y.M. Wong-A-Ton said:
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


Victor said:
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'?
 
S

S.Y.M. Wong-A-Ton

Glad you finally got it to work. And no worries. :)
---
S.Y.M. Wong-A-Ton


Victor said:
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

Victor said:
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?





S.Y.M. Wong-A-Ton said:
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'?
 

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