Miwa
April 22, 2020, 9:35am
1
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,
now =< entrycutoff
<li><a dmx-bind:href="./{{params.permalink}}/{{params.eventsequencial}}/entry/" dmx-class="">Entry</a></li>
eventstart =< now =< eventend
<li><a dmx-bind:href="./{{params.permalink}}/{{params.eventsequencial}}/event/" dmx-class="">Event</a></li>
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?
Teodor
April 22, 2020, 10:00am
2
Hello,
are these links in a repeat region?
Miwa
April 22, 2020, 10:00am
3
no, not in the repeat region.
Teodor
April 22, 2020, 10:02am
4
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.
Miwa
April 22, 2020, 10:03am
5
is “dmx show/hide” possible to include 3 conditions like I mentioned? I prefer easier one.
Teodor
April 22, 2020, 10:04am
6
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
Miwa
April 22, 2020, 10:05am
7
oh I see!! thank you so much!! I try to do so!
Miwa
April 22, 2020, 10:47am
8
by the way, how should I express “now” as a condition?
serverconnect1.data.query_event_info.eventend<now
doesn’t seem work.
Teodor
April 22, 2020, 11:17am
9
You need to add the date and time component in App Connect in order to access the now variable.
1 Like
Miwa
April 22, 2020, 11:53am
10
it worked!! thank you so much!!
1 Like
Miwa
April 25, 2020, 3:15pm
11
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>
Teodor
April 25, 2020, 3:35pm
12
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
Miwa
April 26, 2020, 6:20am
13
It worked! thank you so much!
Antony
April 26, 2020, 8:58pm
14
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
Miwa
April 26, 2020, 10:42pm
15
Oh I didn’t know that feature. I’ll use it next time if I need! Thank you so much.