Title: Hide blank fields?
Last modified: September 8, 2022

---

# Hide blank fields?

 *  Resolved [sp4448](https://wordpress.org/support/users/sp4448/)
 * (@sp4448)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/)
 * Is it possible to hide a blank field?
 * I’m using a dynamic hyperlink like this:
 * I tried using this and it didn’t work:
    <script> if (“”!=”$$FILENAME$$”) { document.
   write(““); } </script>
 * How do I hide it if there’s no $$FILENAME$$?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15990597)
 * Hi [@sp4448](https://wordpress.org/support/users/sp4448/),
 * You cannot use document.write in a dynamic hyperlink, but you can hide a blank
   field using an if-then-else macro. This feature is explained here:
    [https://wpdataaccess.com/docs/data-explorer/dynamic-hyperlinks/](https://wpdataaccess.com/docs/data-explorer/dynamic-hyperlinks/)
 * Please scroll down to the if-then-else macro section. The nested macro examples
   shows how you can catch a blank field value.
 * Let me know if you need further assistance.
 * Good luck,
    Peter
 *  Thread Starter [sp4448](https://wordpress.org/support/users/sp4448/)
 * (@sp4448)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15993789)
 * I’m not familiar with macros and google isn’t being helpful.
 * With the nested macro example, what does each line mean?
 * This is what I’m guessing…
 * If product image is ____ (blank? not blank?)
    and if product name equals sneakers
   show this image If product name does not equal sneakers show N.A. end macro If
   product image is ____ (blank?) show javascript link end macro
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15993855)
 * Hi [@sp4448](https://wordpress.org/support/users/sp4448/),
 * You initial if statement:
 *     ```
       if (""!="$$FILENAME$$") {
       	...
       }
       ```
   
 * Written as macro:
 *     ```
       #macro if "$$FILENAME$$" != ""
       	...   
       #macro end if
       ```
   
 * Replace the … with your own HTML. It is simpler than javascript and above all
   much safer.
 * Hope this helps,
    Peter
 *  Thread Starter [sp4448](https://wordpress.org/support/users/sp4448/)
 * (@sp4448)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15996535)
 * Thank you Peter! You’ve been incredibly helpful and patient.
 * I was able to make it work with blank fields. It hid the field when blank, and
   didn’t hide it when not blank.
 * On its own it works perfectly.
 * However I was trying to include it as part of a paragraph and it won’t work then.
 * This works:
 *     ```
       #macro if "$$FILENAME$$" != ""
       <img src=$$FILENAME$$> 
       #macro end if
       ```
   
 * This doesn’t work:
 *     ```
       Other $$FIELD$$
   
       #macro if "$$FILENAME$$" != ""
       <img src=$$FILENAME$$> 
       #macro end if
   
       More $$FIELDS$$
       ```
   
 * Is the latter possible?
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15996889)
 * Hi [@sp4448](https://wordpress.org/support/users/sp4448/),
 * You can use other columns in a macro, but they have to be within the same table.
   You cannot access columns from another table.
 * If you need to access a column from another table in a publication, you can write
   a view that contain the other column. The Data Publisher works with views just
   like tables. This is possible with projects as well, but eliminates the possibility
   to support transactions.
 * Does this help?
 * Thanks,
    Peter
 *  Thread Starter [sp4448](https://wordpress.org/support/users/sp4448/)
 * (@sp4448)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15996987)
 * They’re all in the same table
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15997214)
 * Hi [@sp4448](https://wordpress.org/support/users/sp4448/),
 * Please check your column name in the Data Explorer:
    – Open the Data Explorer–
   Find your table – Click Manage – Press tab Columns
 * Make sure your write the column name exactly as shown on the Columns tab. Depending
   on your installation column names can be case sensitive.
 * Hope this helps,
    Peter
 *  Thread Starter [sp4448](https://wordpress.org/support/users/sp4448/)
 * (@sp4448)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15998103)
 * All column names are uppercase and match exactly. They appear without a macro
   but won’t appear if using a macro.
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15998407)
 * Can you share your full dynamic hyperlink code? You can use the contact form 
   on the plugin website if you prefer to share this information in private.
 * Thanks,
    Peter

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Hide blank fields?’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/hide-blank-fields-2/#post-15998407)
 * Status: resolved