Populate field of repeating section programmatically

C

CC

We are using Infopath in combination with a 3rd party workflow tool,
so forms will be routed from approver to approver. I want to capture
the date when each approver "actions" the form. i.e. I'd like to be
able to programmatically populate a field in a repeating section with
the current date. I can do this with a flat field, but am having
trouble when the data source is a member of a repeating group.

How can I accomplish this from the Infopath side?

Here is a snippet of the schema without the date:
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Here is what I want (after John Doe has approved the form):
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate>2004-09-15</ApproverDate>
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Thanks
 
J

Jerry Thomas [MSFT]

Is there some other field on the each approver's row of the table that is
changing to indicate they have finished?
It could be as easy as setting a rule so that when their checkbox is
checked, set DateField = Now( ).

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.
 
C

CC

Hi Jerry,

Thanks for your reply. Each approver will be looking at the same
view. They will select "Accept" or "Reject" from a drop down box and
press a "Submit" button. They won't be doing anything else on the
form. I was hoping I could some how use something like 'Now()' when
they hit the submit button, but I don't know how to isolate 'their'
record of the repeating group programmatically. Is there some way to
access the record by use of an index? e.g. something like
Approvers.ApproverDate = now();? I think I could use a separate
xml field to keep track of the index.

Thanks,
Carol


Jerry Thomas said:
Is there some other field on the each approver's row of the table that is
changing to indicate they have finished?
It could be as easy as setting a rule so that when their checkbox is
checked, set DateField = Now( ).

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


CC said:
We are using Infopath in combination with a 3rd party workflow tool,
so forms will be routed from approver to approver. I want to capture
the date when each approver "actions" the form. i.e. I'd like to be
able to programmatically populate a field in a repeating section with
the current date. I can do this with a flat field, but am having
trouble when the data source is a member of a repeating group.

How can I accomplish this from the Infopath side?

Here is a snippet of the schema without the date:
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Here is what I want (after John Doe has approved the form):
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate>2004-09-15</ApproverDate>
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Thanks
 
C

CC

Okay, I think I figured it out. Here's a portion of the code I
execute on my submit button. It's not perfect, and I need to clean it
up a little (e.g. decrement in case of a 'Reject'), but it seems to do
what I need it to do:

if (currView == "ApproverView" && getNodeValue("/my:CR/my:Status", ""
== "Accept")
{
var i = getNodeValue("/my:CR/my:CurrentApproverIndex", "");
XDocument.DOM.selectSingleNode("/my:CR/my:Section_C/my:Approvers["
+ i + "]/my:ApproverDate").text = getUSDateString();
setNodeValue("/my:CR/my:CurrentApproverIndex", ++i);
}


Hi Jerry,

Thanks for your reply. Each approver will be looking at the same
view. They will select "Accept" or "Reject" from a drop down box and
press a "Submit" button. They won't be doing anything else on the
form. I was hoping I could some how use something like 'Now()' when
they hit the submit button, but I don't know how to isolate 'their'
record of the repeating group programmatically. Is there some way to
access the record by use of an index? e.g. something like
Approvers.ApproverDate = now();? I think I could use a separate
xml field to keep track of the index.

Thanks,
Carol


Jerry Thomas said:
Is there some other field on the each approver's row of the table that is
changing to indicate they have finished?
It could be as easy as setting a rule so that when their checkbox is
checked, set DateField = Now( ).

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


CC said:
We are using Infopath in combination with a 3rd party workflow tool,
so forms will be routed from approver to approver. I want to capture
the date when each approver "actions" the form. i.e. I'd like to be
able to programmatically populate a field in a repeating section with
the current date. I can do this with a flat field, but am having
trouble when the data source is a member of a repeating group.

How can I accomplish this from the Infopath side?

Here is a snippet of the schema without the date:
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Here is what I want (after John Doe has approved the form):
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate>2004-09-15</ApproverDate>
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Thanks
 
J

Jerry Thomas [MSFT]

If that works for you, Great!

You can do this by using Rules (and no code).
In your Accept/Reject Drop Down List properties, select Rules.
Add a rule when Accept/Reject field "is not blank", then set DateTime field
= now().

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


CC said:
Okay, I think I figured it out. Here's a portion of the code I
execute on my submit button. It's not perfect, and I need to clean it
up a little (e.g. decrement in case of a 'Reject'), but it seems to do
what I need it to do:

if (currView == "ApproverView" && getNodeValue("/my:CR/my:Status", ""
== "Accept")
{
var i = getNodeValue("/my:CR/my:CurrentApproverIndex", "");
XDocument.DOM.selectSingleNode("/my:CR/my:Section_C/my:Approvers["
+ i + "]/my:ApproverDate").text = getUSDateString();
setNodeValue("/my:CR/my:CurrentApproverIndex", ++i);
}


(e-mail address removed) (CC) wrote in message
Hi Jerry,

Thanks for your reply. Each approver will be looking at the same
view. They will select "Accept" or "Reject" from a drop down box and
press a "Submit" button. They won't be doing anything else on the
form. I was hoping I could some how use something like 'Now()' when
they hit the submit button, but I don't know how to isolate 'their'
record of the repeating group programmatically. Is there some way to
access the record by use of an index? e.g. something like
Approvers.ApproverDate = now();? I think I could use a separate
xml field to keep track of the index.

Thanks,
Carol


"Jerry Thomas [MSFT]" <[email protected]> wrote in message
Is there some other field on the each approver's row of the table that is
changing to indicate they have finished?
It could be as easy as setting a rule so that when their checkbox is
checked, set DateField = Now( ).

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


We are using Infopath in combination with a 3rd party workflow tool,
so forms will be routed from approver to approver. I want to capture
the date when each approver "actions" the form. i.e. I'd like to be
able to programmatically populate a field in a repeating section with
the current date. I can do this with a flat field, but am having
trouble when the data source is a member of a repeating group.

How can I accomplish this from the Infopath side?

Here is a snippet of the schema without the date:
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Here is what I want (after John Doe has approved the form):
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate>2004-09-15</ApproverDate>
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Thanks
 
C

CC

It seems to be working for me so far, anyway... ;-)

Out of curiosity, I tried running a test using the directions you
provided below (it would obviously be a much simpler route). The
problem I encountered, however, was that the moment I selected a value
from the drop down box, ALL the DateTime fields (for each record in
the section) were set to the current time. I only wanted the field
set for 1 of the records (i.e. the current approver). If you think I
did something incorrectly, let me know.. otherwise, I'll stick with
the code I mentioned earlier.

Thanks!
Carol


Jerry Thomas said:
If that works for you, Great!

You can do this by using Rules (and no code).
In your Accept/Reject Drop Down List properties, select Rules.
Add a rule when Accept/Reject field "is not blank", then set DateTime field
= now().

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


CC said:
Okay, I think I figured it out. Here's a portion of the code I
execute on my submit button. It's not perfect, and I need to clean it
up a little (e.g. decrement in case of a 'Reject'), but it seems to do
what I need it to do:

if (currView == "ApproverView" && getNodeValue("/my:CR/my:Status", ""
== "Accept")
{
var i = getNodeValue("/my:CR/my:CurrentApproverIndex", "");
XDocument.DOM.selectSingleNode("/my:CR/my:Section_C/my:Approvers["
+ i + "]/my:ApproverDate").text = getUSDateString();
setNodeValue("/my:CR/my:CurrentApproverIndex", ++i);
}


(e-mail address removed) (CC) wrote in message
Hi Jerry,

Thanks for your reply. Each approver will be looking at the same
view. They will select "Accept" or "Reject" from a drop down box and
press a "Submit" button. They won't be doing anything else on the
form. I was hoping I could some how use something like 'Now()' when
they hit the submit button, but I don't know how to isolate 'their'
record of the repeating group programmatically. Is there some way to
access the record by use of an index? e.g. something like
Approvers.ApproverDate = now();? I think I could use a separate
xml field to keep track of the index.

Thanks,
Carol


"Jerry Thomas [MSFT]" <[email protected]> wrote in message
Is there some other field on the each approver's row of the table that is
changing to indicate they have finished?
It could be as easy as setting a rule so that when their checkbox is
checked, set DateField = Now( ).

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


We are using Infopath in combination with a 3rd party workflow tool,
so forms will be routed from approver to approver. I want to capture
the date when each approver "actions" the form. i.e. I'd like to be
able to programmatically populate a field in a repeating section with
the current date. I can do this with a flat field, but am having
trouble when the data source is a member of a repeating group.

How can I accomplish this from the Infopath side?

Here is a snippet of the schema without the date:
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Here is what I want (after John Doe has approved the form):
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate>2004-09-15</ApproverDate>
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Thanks
 
J

Jerry Thomas [MSFT]

I think I figured this out.

Are you using a single list box outside of the table or 1 list box on each
approvers row?

If the list box is outside of the table, it does not know which date field
to update, so it does them all.
If you have the list box repeating on each row, that gives it the context to
just change that individual date.

-----------------------------------------------------------
| [Approver] | [Accept/Reject] | [Date Time] | [Comments]
-----------------------------------------------------------
--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


CC said:
It seems to be working for me so far, anyway... ;-)

Out of curiosity, I tried running a test using the directions you
provided below (it would obviously be a much simpler route). The
problem I encountered, however, was that the moment I selected a value
from the drop down box, ALL the DateTime fields (for each record in
the section) were set to the current time. I only wanted the field
set for 1 of the records (i.e. the current approver). If you think I
did something incorrectly, let me know.. otherwise, I'll stick with
the code I mentioned earlier.

Thanks!
Carol


"Jerry Thomas [MSFT]" <[email protected]> wrote in message
If that works for you, Great!

You can do this by using Rules (and no code).
In your Accept/Reject Drop Down List properties, select Rules.
Add a rule when Accept/Reject field "is not blank", then set DateTime field
= now().

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


CC said:
Okay, I think I figured it out. Here's a portion of the code I
execute on my submit button. It's not perfect, and I need to clean it
up a little (e.g. decrement in case of a 'Reject'), but it seems to do
what I need it to do:

if (currView == "ApproverView" && getNodeValue("/my:CR/my:Status", ""
== "Accept")
{
var i = getNodeValue("/my:CR/my:CurrentApproverIndex", "");
XDocument.DOM.selectSingleNode("/my:CR/my:Section_C/my:Approvers["
+ i + "]/my:ApproverDate").text = getUSDateString();
setNodeValue("/my:CR/my:CurrentApproverIndex", ++i);
}


(e-mail address removed) (CC) wrote in message
Hi Jerry,

Thanks for your reply. Each approver will be looking at the same
view. They will select "Accept" or "Reject" from a drop down box and
press a "Submit" button. They won't be doing anything else on the
form. I was hoping I could some how use something like 'Now()' when
they hit the submit button, but I don't know how to isolate 'their'
record of the repeating group programmatically. Is there some way to
access the record by use of an index? e.g. something like
Approvers.ApproverDate = now();? I think I could use a separate
xml field to keep track of the index.

Thanks,
Carol


"Jerry Thomas [MSFT]" <[email protected]> wrote in
message
Is there some other field on the each approver's row of the table
that
is
changing to indicate they have finished?
It could be as easy as setting a rule so that when their checkbox is
checked, set DateField = Now( ).
no
rights.
Use of any included script sample are subject to the terms
specified
at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


We are using Infopath in combination with a 3rd party workflow tool,
so forms will be routed from approver to approver. I want to capture
the date when each approver "actions" the form. i.e. I'd like to be
able to programmatically populate a field in a repeating section with
the current date. I can do this with a flat field, but am having
trouble when the data source is a member of a repeating group.

How can I accomplish this from the Infopath side?

Here is a snippet of the schema without the date:
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Here is what I want (after John Doe has approved the form):
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate>2004-09-15</ApproverDate>
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Thanks
 
C

CC

Since the list box is currently unrelated to the repeating group, it
is a single list box outside of the table. But, I will look into
putting that field within the repeating group so that it knows the
context. Because we are using this in a workflow scenario, I don't
really need to keep the 'status' of each reviewer (the process should
not continue to next approver if someone rejects it... it will circle
back to the originator)

Thanks for your help.

Jerry Thomas said:
I think I figured this out.

Are you using a single list box outside of the table or 1 list box on each
approvers row?

If the list box is outside of the table, it does not know which date field
to update, so it does them all.
If you have the list box repeating on each row, that gives it the context to
just change that individual date.

-----------------------------------------------------------
| [Approver] | [Accept/Reject] | [Date Time] | [Comments]
-----------------------------------------------------------
--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


CC said:
It seems to be working for me so far, anyway... ;-)

Out of curiosity, I tried running a test using the directions you
provided below (it would obviously be a much simpler route). The
problem I encountered, however, was that the moment I selected a value
from the drop down box, ALL the DateTime fields (for each record in
the section) were set to the current time. I only wanted the field
set for 1 of the records (i.e. the current approver). If you think I
did something incorrectly, let me know.. otherwise, I'll stick with
the code I mentioned earlier.

Thanks!
Carol


"Jerry Thomas [MSFT]" <[email protected]> wrote in message
If that works for you, Great!

You can do this by using Rules (and no code).
In your Accept/Reject Drop Down List properties, select Rules.
Add a rule when Accept/Reject field "is not blank", then set DateTime field
= now().

--
Jerry Thomas[MSFT]
<[email protected]>
Microsoft Office InfoPath
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


Okay, I think I figured it out. Here's a portion of the code I
execute on my submit button. It's not perfect, and I need to clean it
up a little (e.g. decrement in case of a 'Reject'), but it seems to do
what I need it to do:

if (currView == "ApproverView" && getNodeValue("/my:CR/my:Status", ""
== "Accept")
{
var i = getNodeValue("/my:CR/my:CurrentApproverIndex", "");
XDocument.DOM.selectSingleNode("/my:CR/my:Section_C/my:Approvers["
+ i + "]/my:ApproverDate").text = getUSDateString();
setNodeValue("/my:CR/my:CurrentApproverIndex", ++i);
}


(e-mail address removed) (CC) wrote in message
Hi Jerry,

Thanks for your reply. Each approver will be looking at the same
view. They will select "Accept" or "Reject" from a drop down box and
press a "Submit" button. They won't be doing anything else on the
form. I was hoping I could some how use something like 'Now()' when
they hit the submit button, but I don't know how to isolate 'their'
record of the repeating group programmatically. Is there some way to
access the record by use of an index? e.g. something like
Approvers.ApproverDate = now();? I think I could use a separate
xml field to keep track of the index.

Thanks,
Carol


"Jerry Thomas [MSFT]" <[email protected]> wrote in
message
Is there some other field on the each approver's row of the table
that
is
changing to indicate they have finished?
It could be as easy as setting a rule so that when their checkbox is
checked, set DateField = Now( ).
no
rights.
Use of any included script sample are subject to the terms
specified
at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


We are using Infopath in combination with a 3rd party workflow tool,
so forms will be routed from approver to approver. I want to capture
the date when each approver "actions" the form. i.e. I'd like to be
able to programmatically populate a field in a repeating section with
the current date. I can do this with a flat field, but am having
trouble when the data source is a member of a repeating group.

How can I accomplish this from the Infopath side?

Here is a snippet of the schema without the date:
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Here is what I want (after John Doe has approved the form):
- <Section_C>
- <Approvers>
<ApproverName>John Doe</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate>2004-09-15</ApproverDate>
</Approvers>
- <Approvers>
<ApproverName>Sue Smith</ApproverName>
<ApproverEmail />
<ApproverDisplayName />
<ApproverDate />
</Approvers>
</Section_C>

Thanks
 

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