{"id":142,"date":"2014-01-11T22:18:33","date_gmt":"2014-01-12T03:18:33","guid":{"rendered":"http:\/\/access-diva.com\/blog\/?p=142"},"modified":"2015-12-30T22:52:33","modified_gmt":"2015-12-31T03:52:33","slug":"combining-fields","status":"publish","type":"post","link":"https:\/\/access-diva.com\/blog\/?p=142","title":{"rendered":"Combining Fields"},"content":{"rendered":"<p>Combining fields is easy enough BUT when there&#8217;s a chance one of the fields might be blank (empty), well, that presents an issue.\u00a0 Especially, when you don&#8217;t want the comma, period\u00a0or dash to show if the adjoining\u00a0field is blank (empty), ie: Jane . Doe (no Middle Inital\u00a0so only the period shows) or 9999- (no Order Line Number so only the dash shows).<\/p>\n<p>Below are examples of how to combine the fields taking into account the adjoining field might be empty leaving off the perios, comma or dash (or any other symbol you might be using).<\/p>\n<p>1.\u00a0\u00a0<strong>Jane A. Doe<\/strong> and if no middle initial <strong>Jane Doe<\/strong> use&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n&#x5B;cpFirstName] &amp; (&quot; &quot; + &#x5B;cpMiddleInitial] + &quot;.&quot;) &amp; (&quot; &quot; + &#x5B;cpLastName])\r\n<\/pre>\n<p>2.\u00a0\u00a0<strong>Doe, Jane A.<\/strong>; and if no Middle Initial, <strong>Doe, Jane<\/strong>; and if no Last Name <strong>Jane, A.<\/strong> use&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n(&#x5B;cpLastName] + &quot;, &quot;)\u00a0 &amp; &#x5B;cpFirstName] &amp; (&quot; &quot; + &#x5B;cpMiddleInitial] + &quot;.&quot;)\r\n<\/pre>\n<p>3.\u00a0\u00a0 <strong>Doe, Jane<\/strong> and leaving either First Name or Last Name blank will not result in an empty space before or after the name using&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n(&#x5B;cpLastName] + &quot;, &quot;) &amp; &#x5B;cpFirstName] OR &#x5B;cpLastName] &amp; (&quot;, &quot; + &#x5B;cpFirstName])\r\n<\/pre>\n<p>4.\u00a0\u00a0<strong>Doe Jane<\/strong> and leaving either First Name or Last Name blank will not result in an empty space before or after the name using&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n(&#x5B;cpLastName]+&quot; &quot;) &amp; &#x5B;cpFirstName]\r\n<\/pre>\n<p>5.\u00a0\u00a0<strong>Jane Doe<\/strong> and leaving either First Name or Last Name blank will not result in an empty space before or after the name using&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n&#x5B;cpFirstName] &amp; (&quot; &quot;+&#x5B;cpLastName])\r\n<\/pre>\n<p>6.\u00a0\u00a0<strong>9999-1<\/strong> and if there is no Order Line Number <strong>9999<\/strong> use&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n&#x5B;odOrderID] &amp; (&quot;-&quot;+&#x5B;odOrderLineNumber])\r\n<\/pre>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_142\" class=\"pvc_stats all  \" data-element-id=\"142\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/access-diva.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Combining fields is easy enough BUT when there&#8217;s a chance one of the fields might be blank (empty), well, that presents an issue. Especially, when you don&#8217;t want the comma, period or dash to show if the adjoining field is blank (empty), ie: Jane . Doe (no Middle Inital so only the period shows) or [&#8230;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_142\" class=\"pvc_stats all  \" data-element-id=\"142\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/access-diva.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,38,29],"tags":[75,77],"class_list":["post-142","post","type-post","status-publish","format-standard","hentry","category-access-tips","category-fields","category-strings","tag-fields","tag-strings","odd"],"_links":{"self":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=142"}],"version-history":[{"count":5,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/142\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/142\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}