Page 1 of 1

Multiple variables not working

Posted: Tue Nov 18, 2014 6:12 pm
by hitmanthesilentassasin
Hi,

I am not able to get the below one working whereas the one below is working just fine. The issue here is that the first dictionary field OrgName is being populated as expected but the second dictionary column Supressedsub is not working. what am I doing incorrectly?

Code: Select all

+ | + [ {} != "OF" "ON" ] | ,  | B | B | $ [ {multisuburb} = "Y" ]
COPY      [1] temp
CONCAT    " " temp
CONCAT    [2] temp
COPY temp {OrgName}
COPY      [4] tmp ; Not working
CONCAT    " " tmp ; Not working
CONCAT    [5] tmp ; Not working
COPY tmp {Supressedsub} ; Not working
RETYPE [3] 0
RETYPE [4] 0
RETYPE [5] 0
EXIT

Code: Select all

+ | + [ {} != "OF" "ON" ]  | B  | B | $ [ {multisuburb} = "Y" ]
COPY      [1] temp
CONCAT    " " temp
CONCAT    [2] temp
COPY [3] {Supressedsub}
COPY temp {OrgName}
RETYPE [3] 0
EXIT

Posted: Tue Nov 18, 2014 8:27 pm
by ray.wurlod
Try escaping the comma in the first pattern.

Code: Select all

+ | + [ {} != "OF" "ON" ] | \, | B | B | $ [ {multisuburb} = "Y" ] 

Posted: Tue Nov 18, 2014 9:18 pm
by hitmanthesilentassasin
I have already tried that but still doesnt seem to be working.

Posted: Tue Nov 18, 2014 10:44 pm
by ray.wurlod
Is Supressedsub the actual name in the file dictionary, rather than (for example) SuppressedSub, Suppressedsub or SupressedSub?

Posted: Tue Nov 18, 2014 10:56 pm
by hitmanthesilentassasin
Yes, Supressedsub is exactly the same name(matches case) from dictionary.

Perhaps, I tried copying directly into Supressedsub without tmp variable. Still the result is same.

I have realized that when I am concatenating multiple classification tokens, I am getting this issue.

Posted: Wed Nov 19, 2014 3:36 am
by boxtoby
It might be that the comma is in the separator list (SEPLIST) or strip list (STRIPLIST) at the top of the pattern action.

If it is you may need to remove it bit that might have an effect on other patterns.

Also, are you sure that your new pattern is working at all? Could Orgname be populated from another pattern?


Cheers,
Bob.

Posted: Wed Nov 19, 2014 6:23 am
by hitmanthesilentassasin
I am completely sure that the pattern is working fine because the unknown tokens(+) are getting extracted perfectly. The issue is with the concatenation of the classifications tokens. whenever, I am trying to concatenate classifications tokens the entire string is getting lost hence its not coming up. this includes orgname variable as well. When I try to populate with a simple copy command the dictionary fields and variables are getting populated but when I am trying to concatenate they are getting truncated to null and hence nothing is coming up. I am yet to investigate the retype at the end of the pattern and see if that is causing this issue. Ill check that tomorrow. However, do you reckon anything else that I could investigate upon?

Thanks for your help!!

Posted: Wed Nov 19, 2014 1:09 pm
by rjdickson
Hi,

Can you please post some examples of data and Pattern Action Language you are using? There are so many possibilities that a specific example should help us help you.

Posted: Wed Nov 19, 2014 5:08 pm
by hitmanthesilentassasin
Hi Robert - here is the sample.

Code: Select all

&
PATTERN {modpattern}

Code: Select all

+ | + [ {} != "OF" "ON" "FOR" "AT" ]  | B | O   | O  | $
COPY      [1] temp
CONCAT    " " temp
CONCAT    [2] temp
COPY      [3] {Supressedsub}
CONCAT    " " temp
CONCAT  [4] temp
CONCAT    " " temp
CONCAT  [5] temp
COPY temp {OrgName}
RETYPE [3] 0
EXIT

+ | + [ {} != "OF" "ON" "FOR" "AT" ]  | B | B | O | O | $ [ {multisuburb} = "Y" ]
COPY      [1] temp
CONCAT    " " temp
CONCAT    [2] temp
COPY      [3] tmp
CONCAT " " tmp
CONCAT [4] tmp
CONCAT    " " temp
CONCAT  [5] temp
CONCAT    " " temp
CONCAT  [6] temp
COPY temp {OrgName}
COPY tmp {Supressedsub}
RETYPE [3] 0
RETYPE [4] 0
EXIT
Just before pattern matching I am capturing the modified patterns in modpattern. Following modpattern population I am capturing a pattern(my first 2 patterns) to handle strings like the below example. I have verified multisuburb is getting the value Y

Code: Select all

INPUT: "ABC ABC WASHINGTON PVT LTD" 
OUTPUT Orgname: ABC ABC PVT LTD 
            Supressedsub: WASHINGTON
INPUT:  " ABC ABC NEW YORK PVT LTD" 
OUTPUT: Orgname:"ABC ABC PVT LTD" 
             Supressedsub is not at all getting populated.

Posted: Wed Nov 19, 2014 5:23 pm
by ray.wurlod
Check the classification of PVT. (It doesn't occur in USNAME out of the box, but PTY is classified as W.)

Posted: Wed Nov 19, 2014 5:37 pm
by hitmanthesilentassasin
ray.wurlod wrote:Check the classification of PVT. (It doesn't occur in USNAME out of the box, but PTY is classified as W.) ...
Its a custom ruleset like a preprocessor Ray. I have defined PVT as "O"

Posted: Wed Nov 19, 2014 5:47 pm
by stuartjvnorton
Are New and York both classified as B?
Could it be getting caught by another pattern (or default handling)you have that just pushes the + + O O to OrgName?

It's not a 5-minute task, but I once went through AUNAME and AUADDR and put a DBG field in with a corresponding function that appended a code for every pattern that was ever hit on the way through the PAT.
Proved invaluable for times like this when stuff just doesn't make sense. Most times I wasn't hitting the pattern I thought I was.

Posted: Wed Nov 19, 2014 6:01 pm
by hitmanthesilentassasin
yes, both New and york are classified as B in previous step and also at the same point where the tokens are classified as B, multisuburb is set to "Y" so that I can identify the retyped tokens and source tokens.

There is no chance of other pattern catching in between because this is happening with the first pattern and same thing is repeating till the last one. By the way what is DBG field?

Posted: Wed Nov 19, 2014 6:52 pm
by stuartjvnorton
I added my own field into the DCT file.
Then I wrote a subroutine to append a string to it.
I called that subroutine as the first line of every pattern in the PAT file (unless it called a subroutine, in which case I had to manually append the pattern code).

Can you show us the bit where you re-classified them as B?

Posted: Thu Nov 20, 2014 5:41 am
by hitmanthesilentassasin
Stuart - your question about the retyping solved my problem. I had retyped the operands with empty variable hence it was getting empty values in the field.

Thanks you all for your help here