I have a label and a repeating table which is populated from a repeating field.
The field is assigned values (using InnerXML property) in code behind (getting from web service). So I want to hide the repeating table and the label as well in case there is no value available for the field.
Could I do it in the code behind?
Or how to do it using formatting rules? I have tried the rule with RepeatingField is blank but no luck.
UPDATE:
Screenshot from the table:
Code behind from the form to populate data:
string xmlString = String.Empty;
foreach (var record in records)
{
xmlString += CreateGroup("StatementList");
xmlString += CreateElement("Statement_ID", record.ID
xmlString += CreateElement("Statement_Label", record.Label
xmlString += CreateElement("Statement_Text", record.Text
xmlString += EndGroup("StatementList");
}
if (!String.IsNullOrEmpty(statementXML))
{
XPathNavigator nodeStatement = Root.SelectSingleNode("/my:AuditForm/my:MasterData/my:StatementGroup", NamespaceManager);
nodeStatement.InnerXml = statementXML;
}
Try the below steps for hiding the object in Infopath
If you need to hide Reapting table and lable in infopath then do as follow
Click on Reapting Section
Under Manage Rule Select Formatting
Add a condition as the label is blank
and check the check box for hide this control
If you need to hide label alone in infopath then do as follow
Click on that label
Under Manage Rule Select Formatting
Add a condition as the label is blank
and check the check box for hide this control