Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: string compare problems Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 20:42 | IP Logged Quote patrickm

I am trying to do a string compare in a GOTO LABEL
statement within a macro and I cannot get it to work
correctly.

Within the multiline editor this works:

ph_setvar_s(1,1,"a0:a0:a0:a0:a0:a0") +
ph_setvar_s(1,10,"a0:a0:a0:a0:a0:a0") +
if(match(ph_getvar_s(1,1),ph_getvar_s(1,10)),"GET DATA",
"")

The if statement returns "GET_DATA" as expected.

In the macro the if statement never returns "GET_DATA"
with the same data in LOCAL1 and LOCAL10.

Any ideas?

Thanks
Patrick
Back to Top View patrickm's Profile Search for other posts by patrickm
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 21:18 | IP Logged Quote BeachBum

It worked for me if I understand this correctly. You are loading l1 and l10 with same data and comparing it for a match. If true it goes to label “get data”. The if statement is not a formula but a GOTO.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 21:33 | IP Logged Quote patrickm

Yes it goes to the GET DATA label. I use a similar if match statement in the boolean fields for triggers with no problems.
Back to Top View patrickm's Profile Search for other posts by patrickm
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 21:52 | IP Logged Quote BeachBum

I have set system for L1 and L10 then GOTO with the IF and at the label Get Data I display L1 and L10 and they are the same. What am I missing here...

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 22:03 | IP Logged Quote BeachBum

Patrick, are you saying the data in L1 and L10 are not being passed to the macro from the trigger?

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 22:19 | IP Logged Quote patrickm

Pete,
This what I am trying to do:

I am in a loop loading new values in L10 and use the IF
with the MATCH comparing it to L6. If there is a match
GOTO LABEL Get Data.

Patrick
Back to Top View patrickm's Profile Search for other posts by patrickm
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 22:25 | IP Logged Quote patrickm

The data is passed to the macro via temp5 and is processed
and placed in L6. L10 is retrieved from global variables in
the loop.
Back to Top View patrickm's Profile Search for other posts by patrickm
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 22:32 | IP Logged Quote BeachBum

This is what I tested with:


insert into macroheader values ('TEST','TEST ',0,0,1);
insert into macrodetail values ('TEST',1,38,'',0,'ph_setvar_s(1,1,"a0:a0:a0:a0:a0:a0") +
ph_setvar_s(1,10,"a0:a0:a0:a0:a0:a0") +
if(match(ph_getvar_s(1,1),ph_getvar_s(1,10)),"GET DATA",
"")
',1,'','');
insert into macrodetail values ('TEST',2,15,'[LOCAL1]',NULL,'"a0:a0:a0:a0:a0:a0"',0,'','');
insert into macrodetail values ('TEST',3,15,'[LOCAL10]',NULL,'"a0:a0:a0:a0:a0:a0"',0,'','');
insert into macrodetail values ('TEST',4,27,'',NULL,'if(match(ph_getvar_s(1,1),ph_getvar_s( 1,10)),"GET DATA",
"") ',0,'','');
insert into macrodetail values ('TEST',5,26,'',NULL,'BLANK',0,'','');
insert into macrodetail values ('TEST',6,36,'',NULL,'"BLANK"',0,'','');
insert into macrodetail values ('TEST',7,16,'',NULL,'999',0,'','');
insert into macrodetail values ('TEST',8,26,'',NULL,'GET DATA',0,'','');
insert into macrodetail values ('TEST',9,36,'',NULL,'"GET dATA"',0,'','');
insert into macrodetail values ('TEST',10,36,'',NULL,'"[LOCAL1]" + "[LOCAL10]"',0,'','');


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 22:37 | IP Logged Quote BeachBum

Ships passing in the night.... So it's the GOTO if that fails when there is a match or there is never a match or the data is not the true data?

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 22:43 | IP Logged Quote patrickm

The match never happens even with the same string.
Back to Top View patrickm's Profile Search for other posts by patrickm
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 22:51 | IP Logged Quote BeachBum

Have you tried = instead of a match?

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 22:52 | IP Logged Quote patrickm

Yes I tried to use pos as well.
Back to Top View patrickm's Profile Search for other posts by patrickm
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 22:59 | IP Logged Quote BeachBum

Well damn.... Does it fail 100% or does it have to get deep into the loop? It almost sounds like the data is not holding for the match.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 23:04 | IP Logged Quote patrickm

I put a user message printing both variables and their
lengths and they look identical right before the match
statement.

The only thing I haven't tried is using the temp5
variable directly.
Back to Top View patrickm's Profile Search for other posts by patrickm
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 23:21 | IP Logged Quote BeachBum

Another thought but not a good solution, use globals and see if it sticks.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 23:35 | IP Logged Quote patrickm

I will try globals.

Very similar IF with match() in the boolean of the trigger for the macro works fine...
Back to Top View patrickm's Profile Search for other posts by patrickm
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: July 21 2013 at 23:47 | IP Logged Quote BeachBum

Yup, but I believe you're pretty much dedicated there meaning no interrupts.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 21 2013 at 23:47 | IP Logged Quote patrickm

Globals do not work either.

This is kind of demoralizing.
Back to Top View patrickm's Profile Search for other posts by patrickm
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: July 22 2013 at 12:42 | IP Logged Quote grif091

I used those statements in a Macro without a problem. The GET DATA is missing the underscore GET_DATA. When the variables are equal the GOTO goes to GET_DATA.   When the variables are not equal the GOTO falls through.

Tried to upload a .JPG 57K image. Clicked Upload after selecting file with Browse.   Image did not upload.

Edited by grif091 - July 22 2013 at 13:20


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: July 22 2013 at 13:51 | IP Logged Quote patrickm

Lee,
Thanks for checking that. I am not suprised that I dropped the underscore changing variable types several times.



Back to Top View patrickm's Profile Search for other posts by patrickm
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum