Triggers on sections - Scripting

T

Tom Curtin

I've got great form working that queries a data source and brings back an
existing record. If there is not a record in progress, I'd like to
automatically add a new blank line to a section without the user pressing
insert item. Is there a straight forward way to auto trigger this when the
resulting query is empty? Is there an example of some jscript that might do
something like this.
 
T

Tom Curtin

That's what I've been researching, but can't figure out what the arguments
should be, whether I'm addressing the ADO dataset, the section where the data
is displayed, etc. I see references to things like group1_1 in the other
posts. Any suggestions for good reference materials. I've got a really
anxious business area that wants to see how this prototype is going to work
out...
 
T

Tom Curtin

Just for closure: The code I ultimately added to my button to generate a new
record when the query had not found an existing record was:

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

Just a note -not all controls/sections give you the qualified name of the
xcollection. A repeating table control in fact does. Thanks very much for
your help Greg.

Tom Curtin
<SEA>



Greg Collins said:
Look at the bottom of the Advanced tab of the Properties dialog box for the control (i.e. a repeating table control). There's a code section that gives you the name of the xCollection.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



That's what I've been researching, but can't figure out what the arguments
should be, whether I'm addressing the ADO dataset, the section where the data
is displayed, etc. I see references to things like group1_1 in the other
posts. Any suggestions for good reference materials. I've got a really
anxious business area that wants to see how this prototype is going to work
out...

Greg Collins said:
You can use code to do this.

Look into the ExecuteAction() method. If that doesn't work you can hand-code the insertion using MSXML coding.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I've got great form working that queries a data source and brings back an
existing record. If there is not a record in progress, I'd like to
automatically add a new blank line to a section without the user pressing
insert item. Is there a straight forward way to auto trigger this when the
resulting query is empty? Is there an example of some jscript that might do
something like this.
 
S

sakieboy

I would like to also insert, I'm doing this in VB.Net. How do I figure out
what "xCollection" is? And, how do I figure out what "myrec_91" is?

Tom Curtin said:
Just for closure: The code I ultimately added to my button to generate a new
record when the query had not found an existing record was:

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

Just a note -not all controls/sections give you the qualified name of the
xcollection. A repeating table control in fact does. Thanks very much for
your help Greg.

Tom Curtin
<SEA>



Greg Collins said:
Look at the bottom of the Advanced tab of the Properties dialog box for the control (i.e. a repeating table control). There's a code section that gives you the name of the xCollection.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



That's what I've been researching, but can't figure out what the arguments
should be, whether I'm addressing the ADO dataset, the section where the data
is displayed, etc. I see references to things like group1_1 in the other
posts. Any suggestions for good reference materials. I've got a really
anxious business area that wants to see how this prototype is going to work
out...

Greg Collins said:
You can use code to do this.

Look into the ExecuteAction() method. If that doesn't work you can hand-code the insertion using MSXML coding.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I've got great form working that queries a data source and brings back an
existing record. If there is not a record in progress, I'd like to
automatically add a new blank line to a section without the user pressing
insert item. Is there a straight forward way to auto trigger this when the
resulting query is empty? Is there an example of some jscript that might do
something like this.
 
T

Tom Curtin

xCollection should be the same for you. As greg suggested the autogenerated
control name is in the advanced tab of the controls properties box. As I
mentioned however not all controls show that info. What I did was to redrag
a repeating table control in, get the name from the properties tab, stick my
fields inside that control and add my button with that script. A bit of a
work around.

It would be nice if Infopath let you control the names of controls, or at
least exposed every generated name through the GUI (like in design mode
showing it as a subscript name on the box)

sakieboy said:
I would like to also insert, I'm doing this in VB.Net. How do I figure out
what "xCollection" is? And, how do I figure out what "myrec_91" is?

Tom Curtin said:
Just for closure: The code I ultimately added to my button to generate a new
record when the query had not found an existing record was:

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

Just a note -not all controls/sections give you the qualified name of the
xcollection. A repeating table control in fact does. Thanks very much for
your help Greg.

Tom Curtin
<SEA>



Greg Collins said:
Look at the bottom of the Advanced tab of the Properties dialog box for the control (i.e. a repeating table control). There's a code section that gives you the name of the xCollection.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



That's what I've been researching, but can't figure out what the arguments
should be, whether I'm addressing the ADO dataset, the section where the data
is displayed, etc. I see references to things like group1_1 in the other
posts. Any suggestions for good reference materials. I've got a really
anxious business area that wants to see how this prototype is going to work
out...

:

You can use code to do this.

Look into the ExecuteAction() method. If that doesn't work you can hand-code the insertion using MSXML coding.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I've got great form working that queries a data source and brings back an
existing record. If there is not a record in progress, I'd like to
automatically add a new blank line to a section without the user pressing
insert item. Is there a straight forward way to auto trigger this when the
resulting query is empty? Is there an example of some jscript that might do
something like this.
 

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