How can I set conditions to populate different links?

Similar question of How can I set conditions on dynamic attribute?

<li><a dmx-bind:href="./{{params.permalink}}/{{params.eventsequencial}}/result/" dmx-class="">Result</a></li>

I would like to change this href part depending on the time condition.

for instance,

  1. now =< entrycutoff
<li><a dmx-bind:href="./{{params.permalink}}/{{params.eventsequencial}}/entry/" dmx-class="">Entry</a></li>
  1. eventstart =< now =< eventend
<li><a dmx-bind:href="./{{params.permalink}}/{{params.eventsequencial}}/event/" dmx-class="">Event</a></li>
  1. eventend<now
<li><a dmx-bind:href="./{{params.permalink}}/{{params.eventsequencial}}/result/" dmx-class="">Result</a></li>


I’ve already set this query, btw.

how can I set class toggle of dynamic attributes?

Hello,
are these links in a repeat region?

no, not in the repeat region.

You can either use dmx show/hide to show the link when the specific condition is met or some more complex expression in the link href using a ternary operator.

is “dmx show/hide” possible to include 3 conditions like I mentioned? I prefer easier one.

The easier to apply would be to add the 3 links on the page and for each of them add dynamic attrbiutes > display > show … when: your expression

oh I see!! thank you so much!! I try to do so!

by the way, how should I express “now” as a condition?

serverconnect1.data.query_event_info.eventend<now

doesn’t seem work.

You need to add the date and time component in App Connect in order to access the now variable.

1 Like

it worked!! thank you so much!!

1 Like

Hello,

Related to this thread question.

the following condition doesn’t work…

I would like to show dmx-bind link when eventstart < NOW < eventend.
How can I express the condition in dmx-show?

<li><a dmx-bind:href="./{{params.permalink}}/{{params.eventsequencial}}/event/" dmx-show="(serverconnect1.data.query_event_info[0].eventstart < var1.datetime < serverconnect1.data.query_event_info[0].eventend)">Event</a></li>

Your expression is wrong. It should be:

dmx-show="serverconnect1.data.query_event_info[0].eventstart < var1.datetime && serverconnect1.data.query_event_info[0].eventend > var1.datetime"
1 Like

It worked! thank you so much!

Rather than creating such complex expressions on an element, I prefer to use flows to do this kind of thing… It is easier to read, document and add to if you have to add another condition!

1 Like

Oh I didn’t know that feature. I’ll use it next time if I need! Thank you so much.