Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2020, 10:26 AM
shawn.low@cox.net shawn.low@cox.net is offline IF Statement not working Windows 10 IF Statement not working Office 2016
Novice
IF Statement not working
 
Join Date: May 2019
Location: Aliso Viejo, CA.
Posts: 24
shawn.low@cox.net is on a distinguished road
Default IF Statement not working

Good Morning,

I wanted to ask if someone could please review this and see where i was going wrong. Apologies for the length of this.

I have a Word Doc that needs to build "Dynamically". There is a section currently that is working properly. The code looks like this:

Late Charge: {IF {Mergefield Opportunity_Borrower_Type\*Mergeformat} = "Refinance" "If a payment is late by more then 15 days, you shall be subject to a late fee of $15.00." {IF {Mergefield Opportunity_State\*Mergeformat} = "SC" "If the payment is 15 days late, you will be charged $18.00 or 5% of the unpaid payment amount (A minimum of $7.20 and a maximum of $18.00)." {IF {Mergefield Opportunity_State\* Mergeformat} = "NM" "If a payment is 15 days late, you will be charged the lesser of $10.00 or 5% of the unpaid payment amount." {IF {Mergefield Opportunity_State\*Mergeformat} = "TX" "If a payment is late by more than 10 days, you may be charged the greater of 5% of the delinquent installment amount or $7.50." "If a payment is late by more than 15 days, you shall be subject to a late fee of $15.00."}}}}



I have been asked to have this section of the document only populate, if the loan is a "Bi-Weekly" loan. There is a picklist I can reference for this.
I adjusted the formula to look like this (the part I added is in Bold.

{IF {Mergefield TableStart:BorrowerProductQuery \*Mergeformat}{Mergefield Selected_Product_Frequency \* Mergeformat}{Mergefield TableEnd:BorrowerProductQuery \* Mergeformat} = "Bi-Weekly" "" "Late Charge:{IF {Mergefield Opportunity_Borrower_Type\*Mergeformat} =
"Refinance" "If a payment is late by more then 15 days, you shall be subject to a late fee of $15.00." {IF {Mergefield Opportunity_State\*Mergeformat} = "SC" "If the payment is 15 days late, you will be charged $18.00 or 5% of the unpaid payment amount (A minimum of $7.20 and a maximum of $18.00)." {IF {Mergefield Opportunity_State\* Mergeformat} = "NM" "If a payment is 15 days late, you will be charged the lesser of $10.00 or 5% of the unpaid payment amount." {IF {Mergefield Opportunity_State\*Mergeformat} = "TX" "If a payment is late by more than 10 days, you may be charged the greater of 5% of the delinquent installment amount or $7.50." "If a payment is late by more than 15 days, you shall be subject to a late fee of $15.00."}}}}}

So basically, if the field "Frequency" is "Bi-Weekly" the entire "Late Charge" section should not populate. If the field is anything else, the paragraph needs to be there.
The "TableStart" & "TableEnd" Mergefields are because we are using Conga Composer, and I have to reference a Conga Query for the value in a field called "Frequency".

When I run the Conga Solution, the document fails to generate. So something in the added code is causing it to fail. If I take out the added code, the document generates.


Thank you,
Shawn

Last edited by macropod; 02-26-2020 at 03:02 AM. Reason: Stripped out unhelpful font formatting
Reply With Quote
  #2  
Old 02-26-2020, 03:18 AM
macropod's Avatar
macropod macropod is offline IF Statement not working Windows 7 64bit IF Statement not working Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

All you need is:
{IF{Mergefield Selected_Product_Frequency}<> "Bi-Weekly" "Late Charge: If a payment is {IF{Mergefield Opportunity_Borrower_Type}= "Refinance" "late by more than 15 days, you shall be subject to a late fee of $15.00." {IF{Mergefield Opportunity_State}= "SC" "15 days late, you will be charged $18.00 or 5% of the unpaid payment amount (A minimum of $7.20 and a maximum of $18.00)." {IF{Mergefield Opportunity_State}= "NM" "15 days late, you will be charged the lesser of $10.00 or 5% of the unpaid payment amount." {IF{Mergefield Opportunity_State}= "TX" "late by more than 10 days, you may be charged the greater of 5% of the delinquent installment amount or $7.50." "late by more than 15 days, you shall be subject to a late fee of $15.00."}}}}"}

The added part is shown in red.

Note: You don't need any of the Mergeformat switches; they add nothing useful to the process. I've also simplified the rest of your field coding somewhat.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-27-2020, 11:02 AM
shawn.low@cox.net shawn.low@cox.net is offline IF Statement not working Windows 10 IF Statement not working Office 2016
Novice
IF Statement not working
 
Join Date: May 2019
Location: Aliso Viejo, CA.
Posts: 24
shawn.low@cox.net is on a distinguished road
Default

Hey Paul,


This is still not working properly. I'm not sure if it's a Conga Composer issue or a Word issue.


I tried a test, just to see if I could get this to work at a basic level. I took a document that works fine currently. Conga builds the document properly, and all the merge fields work as expected.


I added this simple code.


{IF {MERGREFIELD TableStart:BorrowerProductQuery \*MERGEFORMAT}{MERGEFIELD Selected_Product_Frequency \*MERGEFORMAT}{MERGEFIELD TableEnd:BorrowerProductQuery \*MERGEFORMAT } = "Bi-Weekly" "" "Hello" }


I know you don't think the MERGEFIELD and MERGEFORMAT aren't needed, but Word adds these, I don't. I use the >Insert > Quick Parts > Field > MergeField
I type in the name of the field in the "Field Name" field. Then click "ok"


Anyway, the document should generate, with the word "Hello" between the two tables.


The document populates, and the Conga Solution runs without fail so that's good. But the document looks like the image below.






What am I doing wrong with this?


Thanks Paul,
Shawn
Reply With Quote
  #4  
Old 02-27-2020, 02:54 PM
macropod's Avatar
macropod macropod is offline IF Statement not working Windows 7 64bit IF Statement not working Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by shawn.low@cox.net View Post
I added this simple code.


{IF {MERGREFIELD TableStart:BorrowerProductQuery \*MERGEFORMAT}{MERGEFIELD Selected_Product_Frequency \*MERGEFORMAT}{MERGEFIELD TableEnd:BorrowerProductQuery \*MERGEFORMAT } = "Bi-Weekly" "" "Hello" }
If you wanted to have 'Hello' between the two tables when the frequency is Bi-Weekly, you use only:
{IF{MERGEFIELD Selected_Product_Frequency}= "Bi-Weekly" "Hello"}
between those two tables. As it is, you have an IF test that incorporates the whole 'BorrowerProductQuery' table as part of the condition being tested against 'Bi-Weekly'. That'll never fly.
Quote:
Originally Posted by shawn.low@cox.net View Post
I know you don't think the MERGEFIELD and MERGEFORMAT aren't needed, but Word adds these, I don't. I use the >Insert > Quick Parts > Field > MergeField
I type in the name of the field in the "Field Name" field. Then click "ok"
I actually said only that the \* MERGEFORMAT switch is unnecessary. The MERGEFIELD designation is most definitely required. You're getting the \* MERGEFORMAT switches because you're leaving the 'Preserve formatting during updates' option checked when you insert the fields. Word will also add them (rather unhelpfully) if you reformat the fields after inserting them.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a Select statement in Excel to an update statement shabbaranks Excel Programming 5 10-31-2018 11:47 PM
Tasks Switch to Non-Working Days on Working Calendar danelloc Project 3 10-02-2017 12:38 PM
Help with IF statement kevinU Excel 0 03-15-2017 02:11 PM
IF Statement not working IF statement mrry475 Excel 1 09-06-2016 09:30 AM
IF Statement not working IF Statement teza2k06 Excel 1 03-11-2015 12:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:26 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft