Using wildcards effectively in IF

I am trying to compare IP addresses that are like a specific set but I am having trouble. The examples below always resolve as false even when an IP would = 10.64.8.102


What I have tried:

 

SyntaxEditor Code Snippet

GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.64."+"%"+"."+"%"+""
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.65."+"%"+"."+"%"+""
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.66."+"%"+"."+"%"+""
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.73."+"%"+"."+"%"+""
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.74."+"%"+"."+"%"+""
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.75."+"%"+"."+"%"+""
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "72.11."+"%"+"."+"%"+""
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "107."+"%"+"."+"%"+"."+"%"+""


SyntaxEditor Code Snippet

GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.64.%.%"
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.65.%.%"
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.66.%.%"
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.73.%.%"
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.74.%.%"
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "10.75.%.%"
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "72.11.%.%"
or GetEdgeLinks3.List[0].EdgeLinks.ipAddress = "107.%.%.%"

I have also tried to use the 'like' operand, but outsystems does not like it.

Thanks.

Solution

Hey Nicholas,

You're right. OutSystems does not support wildcards in IF statements, as far as I know - of course.

If I was in your place, I would use substr instead. Something like:


Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.64." or (...)


Let me know if this helps!

Solution

Armando Gomes wrote:

Hey Nicholas,

You're right. OutSystems does not support wildcards in IF statements, as far as I know - of course.

If I was in your place, I would use substr instead. Something like:


Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.64." or (...)


Let me know if this helps!

This worked perfectly, thanks!



What I ended up with:

SyntaxEditor Code Snippet

Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.64."
or Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.65."
or Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.66."
or Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.73."
or Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.74."
or Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "10.75."
or Substr(GetEdgeLinks3.List[0].EdgeLinks.ipAddress, 0, 6) = "72.11."