I want to use the same sever connect for different purposes and would prefer to not exclude the fields in the Server Connect. Instead, I would like to be able to exclude them in the Repeat region. Is this possible?

I’m hoping there’s a way to do this in the data formats.
It has conditional formatters for Has Key, but I’m not sure if this could be used to exclude a column with that key.

Wouldn’t you just ignore those columns in the repeat? In other words, just don’t add them into the dom at all.
Not sure I’m following. How would I not add them?
My Server Connect provides all of these fields, but for the specific repeat below I do not want to have uuid, Company, or Account being displayed.

<div class="profile-ud-item" dmx-repeat:repeat1="getContact.data.getContact">
<div class="profile-ud wider">
<span class="profile-ud-label" dmx-text="$key">Full Name</span>
<span class="profile-ud-value" dmx-text="$value">Abu Bin Ishtiyak</span>
</div>
</div>
The end goal is to be able to add new fields to the database and have them automatically show without having to modify the page.
Sorry, misunderstood your goal…which seems kinda odd but I’m sure you have good reasons!
1 Like
Couldn’t you just use a dynamic hide to hide the name/field based on those three columns you don’t want? and then everything else in the repeater/DB would show?
1 Like
As @Philip_J says, you could use something like
dmx-hide="(['uuid','Company','Account'].contains($key))"
in the DIV.
Expanding on that, you could make it more dynamic by the use an array in place of 'uuid','Company','Account'
1 Like
Thanks everyone! @UKRiggers your example worked perfectly.
1 Like
Glad it helped.
Just curious, when creating tables dynamically like your example, how do you get around the formatting issues of different $value types? ie number, date, text, boolean etc?
I’m not sure I’m fully understanding your question, so this may be the wrong answer, but at the moment I’m only displaying the key/value.
<div class="nk-block tab-pane active" id="info">
<div class="nk-block-head">
<h5 class="title">Personal Information</h5>
</div>
<!-- .nk-block-head -->
<div class="profile-ud-list">
<div class="profile-ud-item" dmx-repeat:contactDetails="getContact.data.getContact" dmx-hide="(['uuid','Company','Account','isPinned'].contains($key))">
<div class="profile-ud wider">
<span class="profile-ud-label" dmx-text="($key == 'FirstName' ? 'First Name' : $key == 'LastName' ? 'Last Name' : $key == 'companyname' ? 'Company' : $key)">Full Name</span>
<span class="profile-ud-value" dmx-text="$value">Abu Bin Ishtiyak</span>
</div>
</div>
</div>
<!-- .profile-ud-list -->
</div>
<!-- .nk-block -->
I was thinking about things like your ‘VIP’. Instead of '0'
and '1'
, do you not want 'Yes'
and 'No'
for instance? If so, how have you tackled this? Or formatting any dates (if there are any).
Also, looking at the code you have just shown, you could use aliases in the query, so for instance 'Company'
as the alias in the query for 'companyname'
, and 'Last_Name'
for 'LastName'
, then you wouldn’t have to do a ternary operation here. Instead you would just put $key.replace(' ','_')
which would replace any underscore in the Alias with a space.
These are areas I haven't thought through yet. I might end up building a "Menu" table to allow for a display value and database value, then join the tables.
Taking it a step further, I could add the Account field to the table. This would allow the subscribers to my app create their own custom fields
Something like:
Field Name: 'VIP' Display Value: 'Yes' DB Value: '1' Order: '1' Account: 'Global'
Field Name: 'VIP' Display Value: 'No' DB Value: '0' Order: '2' Account: 'Global'
Field Name: 'Favorite Drink' Display Value: 'Coffee' DB Value: '0' Order: '1' Account: 'Customer 1'
Field Name: 'Favorite Drink' Display Value: 'Soda' DB Value: '1' Order: '2' Account: 'Customer 1'
For Date formatting, I'm not sure how to tackle them yet.
The alias and key replace is another great idea. Thanks for that.