#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
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] |
#3
|
|||
|
|||
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 |
#4
|
||||
|
||||
Quote:
{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. 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] |
|
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 | mrry475 | Excel | 1 | 09-06-2016 09:30 AM |
IF Statement | teza2k06 | Excel | 1 | 03-11-2015 12:44 AM |