View.ExecuteAction not working...

S

suraj

Hey guys,

I've done a search on this post on how to insert a row into
a repeating table using Jscript, and found a couple of threads
that answer the question, and it seems simple enough.

In my code I specify:

XDocument.View.ExecuteAction("xCollection::insert", "BenefitsDetailsTable_5");

Where BenefitsDetailsTable_5 is the value specified as xCollection under the
Advanced tab of my repeating table properites. Now the error I get is

"The specified varXmlToEdit value for the View.ExecuteAction call is not
valid."

Now I extracted the form files and looked under the manifest.xsf file, and the
action to insert a row to this table is as follows:

<xsf:button action="xCollection::insert"
xmlToEdit="BenefitsDetailsTable_5"......

so the error is looking for a varXmlToEdit value, while the manifest.xsf file
only specifies BenefitsDetailsTable_5 as a xmlToEdit value.

I'm still somewhat new to InfoPath, so I'm a bit hesitant on playing around
wtih
these extracted form files.

Anybody have an idea on how to resolve this problem? I'd really like to use
the insert feature of the repeating table programmatically.

Any help is greatly appreciated, thanks
suraj
 
M

Matthew Blain \(Serriform\)

Does your form have more than one view? This is a method on the view, so if
the repeating section defined on view1 has xmlToEdit value
BenefitsDetailTable5, you can only call ExecuteAction with xmlToEdit
BenefitsDetailTable5 when view1 is active. You cannot call it when any other
view is active.

--Matthew Blain
http://tips.serriform.com/
 
S

suraj

Thanks Matt, that helped a lot.

Matthew Blain (Serriform) said:
Does your form have more than one view? This is a method on the view, so if
the repeating section defined on view1 has xmlToEdit value
BenefitsDetailTable5, you can only call ExecuteAction with xmlToEdit
BenefitsDetailTable5 when view1 is active. You cannot call it when any other
view is active.

--Matthew Blain
http://tips.serriform.com/
 
M

Matthew Ortiz

OK - I've got the same issue and am getting the following error: 'The
specified bstrAction value for the View.ExecuteAction call is not applicable
for the current selection.'

In my case I currently only have one view, but plan to create others, and am
in the 'OnAfterChange' handler of a check box that is contained in a
repeating table within a repeating section bound to a secondary datasource
within the same view. My intention is to add a row to an other repeating
section called "ActionItem_9" (the XmlToEdit name of the other repeating
section I intend to insert a row on).

When I execute the following command, 'XDocument.View.ExecuteAction(
"xCollection::insert", "ActionItem_9" );', the error above occurs.

I would appreciate any help on this.

Thanks,

Matthew Ortiz
 
M

Matthew Ortiz

Well the solution in my case was that when in the OnAfterChange handler of a
bound repeating table, context needed to be set to the repeating table that
your adding the row to by using the 'XDocument.View.SelectNodes(...)' method.
I haven't yet checked if context could be set anywhere outside of the bound
control but in our case it was where we wanted to land anyway.

So, when the call to 'XDocument.View.ExecuteAction( "xCollection::insert",
....)' was made from within an unbound repeating section it worked, this was
our test to simulate our environment in microcosm, this then brought my
colleague and me to find the resolution after some additional research.

Thanks

Matthew Ortiz
 

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