Home › Forums › ACF PRO › Empty Field Check in SQL › Reply To: Empty Field Check in SQL
Thanks https://support.advancedcustomfields.com/forums/users/hube2/
This worked but was still not entirely the solution as I found I had yet another custom field to check against..and applying the way you solved this I thought I had it…
What I need is something like this but it isn’t working..
Pseudo code
IF all are relation are true (AND)
AND
sale price <300
AND
either status NOT EXISTS
OR
either status =”
AND
either sp-alt NOT EXISTS
OR
either sp-alt =”
code..` ‘meta_query’ => array(
‘relation’ => ‘AND’,
//AND
array(
‘key’ => ‘sale_price’,
‘value’ => 300000,
‘type’ => ‘NUMERIC’,
‘compare’ => ‘<‘
),
//AND
array(
‘relation’ => ‘OR’,
array(
‘key’ => ‘status’,
‘compare’ => ‘NOT EXISTS’
),
array(
‘key’ => ‘status’,
‘value’ => ”,
‘compare’ => ‘=’
)
),
//AND
array(
‘relation’ => ‘OR’,
array(
‘key’ => ‘sp-alt’,
‘compare’ => ‘NOT EXISTS’
),
array(
‘key’ => ‘sp-alt’,
‘value’ => ”,
‘compare’ => ‘=’
)
),`
I get that we need to check OR for each field as it can be one or the other or at least one if it is both..
I only want to see an item if it is less than 300 and doesn’t have a value in any of the fields sp-alt or status..if anything is in either of those fields I DON’T want to show the item. My logic seems right after you helped me get this far.
TY anyway I am going to play more..
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.