Hide if serverconnect data value is blank/empty

how can I hide a

  • I have many fields in the database but do not want a particular LI to show if the serverconnect data value is empty/blank/null
  • You can use the show/hide in Dynamic Attributes as shown here https://github.com/Wappler/docs/wiki/Dynamic-Attributes#showhide-elements-with-dynamic-expressions

    I fully know that process and that is what i was looking to do. But for the conditions I do not know how to have it be show if there is a value in in the serverconnect datafield.

    I did this in previous hand coded php sites using the if ($query.fieldname === empty() ) queries.

    You need to select the query in the data picker, click the formatter icon and select Has Items.
    This checks if the query has items - if yes, returns true, if no returns false.

    1 Like

    yes i know that on the whole query, but I am looking at a specific field in the query result.

    Not all my results have this field store a value, so I do not want to show on the screen if there is not value in the field. this is for a report output…

    Its even easier then just use your binding as an expression…

    <p dmx-show="binding">binding</p>
    

    perfect that worked. Was this in the guides somewhere else?

    It’s already explained in the tutorial Ben sent you. Show/hide checks the value and it doesn’t matter if it is a binding, form value or any other value.

    ok, not specific to my item as the guide is for check a field value then show, but I understand how to use it now… thanks

    hi ben i am trying to hide/show values depending if a record exists but i cant do it.

        <tr dmx-show="self_assess_profile_id=SRVSelfAssess.data.QselfassessByYear[0].self_assess_profile_id">
    <td class="text-bold-500"><a dmx-bind:href="_SelfAssessment.php?self_assess_profile_id={{Srvuser.data.QPageDetails[0].profile_id}}">Self Assessment</a></td>
    <td>{{SRVSelfAssess.data.QselfassessByYear[0].sa_year}}</td>
    <td class="text-bold-500">VIEW ICON</td>
    </tr>
    

    tried your tutorial but cant find the value field!!

    thanks for your help in advance

    vitor

    Hi Vitor,

    Ideally, you would have a repeat region for {{SRVSelfAssess.data.QselfassessByYear}} and the show/hide region as a child.

    Somthing like:

    <div class="row" id="rptAssessment" dmx-bind:repeat="SRVSelfAssess.data.QselfassessByYear">
      <p dmx-show="sa_year">Show me</p> <!-- sa_year is a true value when it contains data -->
    </div>

    thanks guys, sorry for the delay in answering, just back home.
    so i am buildind an appraisal system.
    so the staff log in and this page is filtered by year and userid, displaying what they have filled.
    What i would like to have his:
    all the areas/forms (the ones on the list) to be hidden unless there is a record that matches the data.
    Do i need to do a repeat region even though the page is already been filtered?

    I really appreciate all your help.
    Thank you to Ben and Teo

    Solved it.
    Made a video just in case others need it.
    when on the browser i went to the db and deleted the user id “as if there were no records” then reinstated the user again. works perfectly.

    thanks for your help. sometimes after reading a few times it just makes sense, plus the help of everyone helps imensly…even on a saturday evening.

    cheers

    wappler-show-row.mp4 (21.6 MB)

    2 Likes