if else expression condition

if else expression condition

  

Hi All,

  i have an ID with link ,now i have to check if that id="text" then disable link else enable link. how to do this ? 

ex:

ID  =   "text"      (here ID is disabled)

 ID    !=  "text"    (here ID is enabled)


Thanks,

Ronan T

Solution

Hai Ronan,

 try using the condition If(id="text",True,False) in the enabled feature of the link.

Let me know if this helped

Thanks

Solution

Hi Ronan,

You can use TextToIntegerValidate() function, it will return true or false based on the text is convertible to integer or not. Text will be only convertible to integer, if the value is integer. So you can apply your condition in Enabled property of link as ->

if(TextToIntegerValidate(Pass Your ID here),True,False)

Hi Ronan,

It is not advisable to use the "Enabled" property because this is something that can be easily manipulated by the user through the browser tools. For your situation, I would use an IF widget to check for the value of ID. In the True part of the IF, use just an expression to display the ID without any links. In the False part, insert the link.

Charles Raphel D wrote:

Hai Ronan,

 try using the condition If(id="text",True,False) in the enabled feature of the link.

Let me know if this helped

Thanks

Thank you Charles Raphel D it helped me.


Ok, everyone who gave any answer with an If resulting in a True or False fails the exam :). Seriously, never ever do that, as it is totally superfluous. A condition aready results in a Boolean, so any Expression that looks like this:

If(<condition>, True, False)

Can be simplified to just:

<condition>

Using an If with True and False output only convolutes your code. Don't do this!

Kilian Hekhuis wrote:

Ok, everyone who gave any answer with an If resulting in a True or False fails the exam :). Seriously, never ever do that, as it is totally superfluous. A condition aready results in a Boolean, so any Expression that looks like this:

If(<condition>, True, False)

Can be simplified to just: 

<condition>

Using an If with True and False output only convolutes your code. Don't do this!

 Hi Kilian Hekhuis,

             if we use   If(id="text")  it will show an error .

Thanks,

Ronan T

Ronan,

Please, do you have any background in software development? It's just 'id = "text"', without the If, like I said in my example above. Geez...