Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-19-2019, 09:08 AM
yarrington yarrington is offline Document Merge and IF statement Windows 7 64bit Document Merge and IF statement Office 2013
Novice
Document Merge and IF statement
 
Join Date: Sep 2019
Posts: 4
yarrington is on a distinguished road
Default Document Merge and IF statement

I am new to mail merge or document merge. I do have a programing background, but never had to do this before so please be patient as I try to explain.



The company I work for has acquired some software where any custom reporting is done through word or excel merge. They simply provided a document with all the oracle database tables' fields such as {FLPM3100_V.FL3100_SCOPE_DESC}which they want you to copy paste to the template you want to make. Upload it to their server run the report and thus retrieves the values in the format you set. Now this works fine but when it comes to fields that are left empty like an address or a cost I need to write a condition statement to not include "," or "$" so on. I've been reading on mail merge and how it works, and syntax needed and I thought I had it but I think I am missing something int he syntax, although I don't get an error, it does not give me the correct results.
What I have is { IF { MERGEFIELD FLPM2030_V.FL2030_PMP_ADD_LINE3 } = "" "" ","} I inserted this basic statement using the insert tab then quick parts >field>mail merge>mergefield in word. I then deleted what was inside and went to same menu options and in the dialog where it says field name I pasted FLPM2030_V.FL2030_PMP_ADD_LINE3. Which I am assuming the first part of the period is reference to database and second half is actual table field name. Since it is a black box into the system and it's repository, I don't know for sure, but I know that when I reference the fields this way without any conditions the values display.

Could someone please clarify what I am doing wrong?

Thanks
Reply With Quote
  #2  
Old 09-19-2019, 03:53 PM
macropod's Avatar
macropod macropod is offline Document Merge and IF statement Windows 7 64bit Document Merge and IF statement 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

Did you read the Mailmerge Tips & Tricks article at the top of this forum (https://www.msofficeforums.com/mail-...-tricks.html)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-24-2019, 11:33 AM
yarrington yarrington is offline Document Merge and IF statement Windows 7 64bit Document Merge and IF statement Office 2013
Novice
Document Merge and IF statement
 
Join Date: Sep 2019
Posts: 4
yarrington is on a distinguished road
Default

macropod, so I read through the entire entry, I understand a bit more, but none worked. Like I said it is a black box, I don't know what is happening in their backend. Simply that accessing the field in their template copying them to mine will access the values. However whenever, I use a condition statement with the fields it doesn't work, but if I simply hard code the condition, the results are as expected. So the structure of the condition statement I got correct, but accessing the values with the limits they gave do not work. I thought about using mergerec in the condition statement instead but technically there is a record return just not all fields have value, so that will not work.

Is the fact that they have what looks like a database reference prohibit the statement from getting the values FLPM2030_V.FL2030_PMP_ADD_LINE3?
Reply With Quote
  #4  
Old 09-24-2019, 03:41 PM
macropod's Avatar
macropod macropod is offline Document Merge and IF statement Windows 7 64bit Document Merge and IF statement 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

Without actually seeing the mailmerge main document, it can be difficult for anyone to diagnose the issue. Can you attach the document to a post (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 09-24-2019, 07:57 PM
yarrington yarrington is offline Document Merge and IF statement Windows 7 64bit Document Merge and IF statement Office 2013
Novice
Document Merge and IF statement
 
Join Date: Sep 2019
Posts: 4
yarrington is on a distinguished road
Default

Okay this is one of the files. The comma at the "WORK AT" is where I have the IF Statement. I can send you the doc with it toggled open. But we do not see or know of any data sources we simply load this up to their server and it is executed to another docx or pdf depending on what the user select for the output.
Attached Files
File Type: docx STARR Purchase Order RV.docx (22.3 KB, 8 views)
Reply With Quote
  #6  
Old 09-24-2019, 09:02 PM
macropod's Avatar
macropod macropod is offline Document Merge and IF statement Windows 7 64bit Document Merge and IF statement 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

The fields in your document are not mergefields - they're formfields containing text strings like:
{FLPM2030_V.FL2030_CUSADD_ADD3}
That also means the document isn't being populated via a mailmerge, so mailmerge techniques, per se, won't work. For the field in question, though, whose formfield bookmark name is 'Text2', you might be able to use a field coded as:
{IF{REF Text2}<> " " ","}
Whether that would work depends on whether the formfields survive whatever document-update process your system employs. If the formfields get replaced with the output text, the above won't work.

Note: The field brace pairs (i.e. '{ }') for the above field coding example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. The spaces represented in the field construction are all required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 09-25-2019, 08:09 AM
yarrington yarrington is offline Document Merge and IF statement Windows 7 64bit Document Merge and IF statement Office 2013
Novice
Document Merge and IF statement
 
Join Date: Sep 2019
Posts: 4
yarrington is on a distinguished road
Default

I was afraid of that, I will try what you suggested. I didn't insert the curly braces, I used the drop down in insert>quick parts for the condition statement, as for the form fields were provided by the company that provided the master field list.

Thank you very much for your expertise
Reply With Quote
Reply

Tags
condition statement, document merge, mail merge code

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
Mail Merge If statement kevinatshale Mail Merge 1 03-07-2013 04:36 PM
Document Merge and IF statement Mail Merge Function not Noticing 'True' vs. 'False' Statement danellekent Mail Merge 1 04-27-2012 02:19 AM
Document Merge and IF statement Mail merge will not format date field generated by Excel IF statement borntorun75 Mail Merge 3 12-16-2011 06:28 AM
Document Merge and IF statement Select statement to a new document ishaw Word 1 10-17-2011 02:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:36 PM.


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