Solved

IF condition to display a Table in Word document

  • 12 September 2017
  • 7 replies
  • 1124 views

Hi Team,

In word document which we have prepared I want to use IF condition in such a way that if the condition is True then it displays a table and if not then it shouldn't get displayed. What i did was created an IF statement from Insert>Quick Parts>Field i.e. IF Expression1 <> "" "Success" "Failure". After this I edited this IF condition to the image inserted below.IF condition statement

 

So what does the above snippet suggest that if the Tagger field is not "" then it should display the table else it shouldn't. But when I am trying to do in such way i am getting failure. So can the team help me in suggesting that how can i display a table in if condition as per the image snippet attached above.

icon

Best answer by DocGenVinnie 13 September 2017, 16:19

View original

7 replies

Badge +7

You are really close.  You just need to put the tags in the first part of the condition in quotes.  Here is an example from our support site for conditional text.

Hey thanks for the reply!

Can you share the code snippet depicting the same as such i tried with the same way but not getting success.

Badge +7

Pratik, here is a sample document that should work in any org.  This is a conditional table based on Account Billing State. "CA" will show a CA table and any other state would show the OtherState table.

Conditional Table

Userlevel 4
Badge +8

‌,

Don't forget to right click and update otherwise your changes won't take effect.

Cheers,

Please find below the snap which depicts the code with both IF condition and without IF condition.

and right below is my output result.

You can easily find out the difference that the output of IF condition is not displaying properly compared to the output of without IF condition.

Also I am attaching the sample code file which I have made. Sample Doc

Can you share your thoughts on the same.

Hey Ryan,

I tried with updating the field but still no success. I added a comment with the code snippet an a sample code file. If you can have a look at those and can give your view on the same.

Badge +7

Pratik, per our email exchange the quotes needed to be added to the tag

"<<Carrier_Generic_Supp_App_QuestionText1>>"

in the IF portion of the formula.

Here is the formula that worked.

Reply