M
Meg
I have a Run Query Button in InfoPath, but I can't find anywhere that I can
add a rule to it. Can it be done and if so, how?
Thanks,
MEG
add a rule to it. Can it be done and if so, how?
Thanks,
MEG
Zhang Haiguang said:Please try to use codes to clear the query field and query result fields,
as the following InfoPath 2003 managed code:
[InfoPathEventHandler(EventType=InfoPathEventType.OnSwitchView)]
public void OnSwitchView(DocEvent e)
{
// Write your code here.
DOMNode idNode = thisXDocument.DOM.selectNodes(
"/dfs:myFields/dfs:queryFields/q:Employees/@EmployeeID" );
idNode.nodeValue = ""
if( thisXDocument.View.Name.Equals( "View 1" ) )
{
DOMNodeList nodeList = thisXDocument.DOM.selectNodes(
"/dfs:myFields/dfs:dataFields/d:Employees" );
foreach( DOMNode node in nodeList )
{
node.parentNode.removeChild(node);
}
}
}
InfoPath Web Form [http://www.infojetsoft.com]
Meg said:Thanks, I did try that but it still never gave me the results I wanted.
Maybe someone else out their knows.
It did clear the fields but, I have 2 views 1 is for data entry and 1 is
for
search and edit. When I search for a record by name I get all the
records
for that person which I want but when I want to complete a new record I
switch to the Data Entry View and it still has all the search records and
I
want 1 blank form for them to enter another record.
Maybe I am asking too much.
MEG
Zhang Haiguang said:Oh, it should be:
[InfoPathEventHandler(EventType=InfoPathEventType.OnSwitchView)]
public void OnSwitchView(DocEvent e)
{
// Write your code here.
if( thisXDocument.View.Name.Equals( "View 1" ) )
{
DOMNode idNode = thisXDocument.DOM.selectNodes(
"/dfs:myFields/dfs:queryFields/q:Employees/@EmployeeID" );
idNode.nodeValue = ""
DOMNodeList nodeList = thisXDocument.DOM.selectNodes(
"/dfs:myFields/dfs:dataFields/d:Employees" );
foreach( DOMNode node in nodeList )
{
node.parentNode.removeChild(node);
}
}
}
Zhang Haiguang said:Please try to use codes to clear the query field and query result fields,
as the following InfoPath 2003 managed code:
[InfoPathEventHandler(EventType=InfoPathEventType.OnSwitchView)]
public void OnSwitchView(DocEvent e)
{
// Write your code here.
DOMNode idNode = thisXDocument.DOM.selectNodes(
"/dfs:myFields/dfs:queryFields/q:Employees/@EmployeeID" );
idNode.nodeValue = ""
if( thisXDocument.View.Name.Equals( "View 1" ) )
{
DOMNodeList nodeList = thisXDocument.DOM.selectNodes(
"/dfs:myFields/dfs:dataFields/d:Employees" );
foreach( DOMNode node in nodeList )
{
node.parentNode.removeChild(node);
}
}
}
InfoPath Web Form [http://www.infojetsoft.com]
Meg said:Thanks, I did try that but it still never gave me the results I wanted.
Maybe someone else out their knows.
It did clear the fields but, I have 2 views 1 is for data entry and 1 is
for
search and edit. When I search for a record by name I get all the
records
for that person which I want but when I want to complete a new record I
switch to the Data Entry View and it still has all the search records and
I
want 1 blank form for them to enter another record.
Maybe I am asking too much.
MEG
:
Sorry, I don't know. Maybe you could clear the fields in "Set a field's
value" action one by one...
Is there a way to clear the form (make it blank) after running the
Query?
:
Please try to replace the Query Button with a common button, add the
rule
to
it, at last add a "Query using a data connection" action to the rule.
http://www.infojetsoft.com, InfoJet Service, a product likes InfoPath
Forms
Services.
I have a Run Query Button in InfoPath, but I can't find anywhere
that I
can
add a rule to it. Can it be done and if so, how?
Thanks,
MEG