Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Is it possible to Compare multiple Link Property fields?

Quote Reply
Is it possible to Compare multiple Link Property fields?
Below is an example of few fields under link properties for example link with ID 2:

rand1 = a
rand2 = b
rand3 = c
rand4 = d
rand5 = e
rand6 = f
rand7 = g
rand8 = h
rand9 = i


I am trying to use below if/elsif comparison code, however, it does not seem to work :(

<%if $rand1 EQ $rand2 OR $rand2 OR $rand3 OR $rand4 OR $rand5 OR $rand6 OR $rand7 OR $rand8 OR $rand9 %>
rand3 = Yes, it matches a field
<%else%>
No match found.. So display : Rand3 = <%rand3%>
<%endif%>

Any idea on what am I doing wrong or what the right if/elsif code should be above?

Thanks.

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] Is it possible to Compare multiple Link Property fields? In reply to
As far as I see it should be

Code:
<%if $rand1 eq $rand2 OR $rand1 eq $rand3 ...

or even

Code:
<%if rand1 eq $rand2 OR rand1 eq $rand3 ...

Not exactly sure if I understood your idea...

Cheers

Niko

Last edited by:

el noe: Mar 6, 2020, 10:24 AM
Quote Reply
Re: [el noe] Is it possible to Compare multiple Link Property fields? In reply to
Hi Niko,

You are right.. I changed it as suggested

<%if rand1 eq $rand2 OR rand1 eq $rand3 OR rand1 eq $rand4 OR rand1 eq $rand5 OR rand1 eq $rand6 OR rand1 eq $rand7%>
rand3 = Matches to One of the other rand value.
<%else%>
Rand3 = <%rand3%> ... rand1 does not match any other rand values.
<%endif%>


& it worked. Thank you for correcting me & helping me understand. Appreciate it.

Vishal
-------------------------------------------------------

Last edited by:

VishalT: Mar 6, 2020, 2:49 PM
Quote Reply
Re: [VishalT] Is it possible to Compare multiple Link Property fields? In reply to
Hi Vishal,

Happy that I could help, you are welcome.

Cheers

Niko