I have a need to parse a nested IF statement to show it content from open tag to closing tag.
Hi Paul,
Hi there,
http://www.aspose.com/community/forums/263016/merging-of-conditional-if-with-autotext-fields-as-condition-within-if/showthread.aspx#263016
The link above, referenced in the preceding post, is not working or broken.
I would like to know an approach to a similar, if not the same, issue.
I have fields in a document, and these fields can be nested within IF fields. I am trying to find out how to figure out the expressions on which they depend.
For example:
{ IF {MERGEFIELD MyField } = true “{MERGEFIELD YourField}” “{MERGEFIELD HisField}” }
Above, we can see that YourField is based on MyField = true, and also, that HisField is based on MyField <> true.
MyField, YourField and HisField are all tied to controls in the UI. Therefore, if we could develop the dependency relationships programatically with Aspose, we could enable the control for YourField if MyField = true. Otherwise, we could disable it.
It is a little more complex, but the same idea, for nested IF fields., like this:
{ IF {MERGEFIELD MyField } = true “{MERGEFIELD YourField}” "{ IF {MERGEFIELD HisField} = true “{MERGEFIELD HisDog}” “{MERGEFIELD HisCat” " }
Here, HisDog is based on (MyField <> true AND HisField = true).
HisCat is based on (MyField <> true AND HisField <> true).
Thus, knowing this programatically, we could enable the textBox for HisDog and disable it appropriately, based on the values provided in the UI to MyField and HisField.
I think this makes perfect sense, and I believe it is feasible. It’s just a matter of how much trouble one has to go through to build the expressions.
Thanks.
Hi Jeff,
JeffMatthews:
I have fields in a document, and these fields can be nested within IF fields. I am trying to find out how to figure out the expressions on which they depend.
{ IF true = true YourField_Result…
Hi, Tahir. Your reply was close to what I am wanting to know.
Let me be more precise. Let’s say the template has this expression:
{ IF { MERGEFIELD MyField } = true “{ IF { MERGEFIELD HisField } = true “{ MERGEFIELD ThisField }” “{ MERGEFIELD ThatField }” }” “{ MERGEFIELD TheOtherField }” }
I want to look into the above with Aspose and generate the following:
For ThisField: " ( MyField == true && HisField == true ) "
For ThatField: ( MyField == true && HisField != true ) "
For TheOtherField: " MyField != true"
As you can see, I am wanting to build the compound condition strings associated with whether the target field (This, That or the Other) is in the result of ANY field in the merged template.
Here would be an example of needing to build an OR expression:
{ IF { MERGEFIELD MyField } = true “{ MERGEFIELD ThisField }” }
{ IF { MERGEFIELD YourField } = true “{ MERGEFIELD ThisField }” }
Here, you would want to build the OR expression for ThisField as
( MyField == true || YourField == true )
These expressions could be run in our code for run-time evaluation. Then, we could enable or disable controls in a manner which matches the Word template’s logic.
Let’s say MyField is really a Visual Studio C# checkBox. YourField is, too. Let’s finally say that ThisField is a textBox.
Basically, the ThisField textBox would be enabled only if MyField OR YourField was checked. This makes the User Interface form’s enable/disable logic match the needs of the Word template. Rather than have to duplicate the logic by expressly coding it in the UI, we ought to be able to create it from the template and apply it by using run-time evaluation on an equation.
Hi Jeff,
Hi Jeff,