1

In mapbasic I am creating hotlinks with the code below. However when there is no value in the column it creates a hyperlink that doesn't work and this is frustrating for users. Is it possible to only have the hyperlink on records with a value? or at least for those without a value the alias should say "No AsCon found"

Map From temptable
mapWinID = FrontWindow()
Set Map Window mapWinID Layer 1 Activate Using "https://server.com/docs/~D"+"As_con_InfoExpert_ID" On Labels Objects Relative Path Off Enable On
Metadata Table temptable SetKey "\ActiveObject\Expr" To ("""https://server.com/docs/~D""+As_con_InfoExpert_ID")
Metadata Table temptable SetKey "\ActiveObject\Mode" To "HOTLINK_MODE_BOTH"
Metadata Table temptable SetKey "\ActiveObject\Relative" To "OFF"
Metadata Table temptable SetKey "\ActiveObject\Enabled" To "TRUE"
Metadata Table temptable SetKey "\ActiveObject\Alias" To ("Open in Infoexpert")
2
  • Could you select the data that has the values first into a 'holding' table, then use the MapBasic on that selection?
    – Mark
    Commented Aug 29, 2018 at 14:14
  • I don't this so as the hotlinks are on/off for a whole table and not a selection of one (as far as I know)...
    – GeorgeC
    Commented Aug 30, 2018 at 14:27

1 Answer 1

1

If you are using MapInfo Pro 17.0, you can try using the IIf() function to only build an expression for the records with a value:

Metadata Table temptable SetKey "\ActiveObject\Expr" To ("IIf(As_con_InfoExpert_ID, ""https://server.com/docs/~D""+As_con_InfoExpert_ID, """")")

You might want to check if I have the correct number of quotes in the expression above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.