| Author | 
         | 
         
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 20:42 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 21:18 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 21:33 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 21:52 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 22:03 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 22:19 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 22:25 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 22:32 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 22:37 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 22:43 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
The match never happens even with the same string.
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 22:51 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Have you tried = instead of a match?
  __________________ Pete - X10 Oldie
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 22:52 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Yes I tried to use pos as well.
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 22:59 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 23:04 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 23:21 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Another thought but not a good solution, use globals and see if it sticks.
  __________________ Pete - X10 Oldie
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 23:35 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
I will try globals.
 
 Very similar IF with match() in the boolean of the trigger for the macro works fine...
 
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         BeachBum Super User 
          
  
  Joined: April 11 2007 Location: United States
 Online Status: Offline Posts: 1880
          | 
        
         
          
           | Posted: July 21 2013 at 23:47 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Yup, but I believe you're pretty much dedicated there meaning no interrupts.
  __________________ Pete - X10 Oldie
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 21 2013 at 23:47 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Globals do not work either.  
 
 This is kind of demoralizing.
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         grif091 Super User 
          
 
  Joined: March 26 2008 Location: United States
 Online Status: Offline Posts: 1357
          | 
        
         
          
           | Posted: July 22 2013 at 12:42 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         patrickm Senior Member 
          
 
  Joined: February 22 2007 Location: United States
 Online Status: Offline Posts: 188
          | 
        
         
          
           | Posted: July 22 2013 at 13:51 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Lee,
 Thanks for checking that.  I am not suprised that I dropped the underscore changing variable types several times.
 
 
 
 
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   |