Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Parsing an amper variable
Go
New
Search
Notify
Tools
Reply
  
Parsing an amper variable
 Login/Join
 
<Derek>
posted
Does anyone know the correct way to parse an amper variable. I'm passing in a variable called &CENTER from an html form. I want to extract the first 3 chars. and put them in a like statement. I've tried using EDIT and SUBSTR without success.

I tried to use an edit and receive this error... (FOC002) A WORD IS NOT RECOGNIZED: SUB_CENTER/A3

TABLE FILE TBLLIC_BASE
PRINT
OWNING_ORG
LICENSE_NUMBER
FORMAL_NAME
LICENSE_INITIATED
EXECUTION_DATE
CLOSE_DATE
TITLE

SUB_CENTER/A3 = EDIT(&CENTER, '999*');

WHERE TBLLIC_BASE.OWNING_ORG LIKE 'SUB_CENTER%';


I have also tried this and recived an error saying...(FOC36355) INVALID TYPE OF ARGUMENT #2 FOR USER FUNCTION SUBSTR

DEFINE FILE TBLLIC_BASE
SUB_CENTER/A3=SUBSTR(5, &CENTER, 1, 3, 3, SUB_CENTER);
END;

TABLE FILE TBLLIC_BASE
PRINT
OWNING_ORG
LICENSE_NUMBER
FORMAL_NAME
LICENSE_INITIATED
EXECUTION_DATE
CLOSE_DATE
TITLE
WHERE TBLLIC_BASE.OWNING_ORG LIKE 'SUB_CENTER%';
 
Reply With QuoteReport This Post
Silver Member
posted Hide Post
try:

-SET &CNTR = EDIT(&CENTER,'999')|'%';

TABLE FILE TBLLIC_BASE
PRINT
OWNING_ORG
LICENSE_NUMBER
FORMAL_NAME
LICENSE_INITIATED
EXECUTION_DATE
CLOSE_DATE
TITLE

WHERE TBLLIC_BASE.OWNING_ORG LIKE '&CNTR';

hth,

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Reply With QuoteReport This Post
<Pietro De Santis>
posted
You should be able to do the following:

-SET &SUB_CENTER = EDIT(&CENTER, '999');

Then:

TABLE FILE TBLLIC_BASE
...
WHERE TBLLIC_BASE.OWNING_ORG LIKE '&SUB_CENTER.EVAL%';
END
 
Reply With QuoteReport This Post
<Derek>
posted
Thanks for the quick response. Pietro's solution worked. It looks like it needed the .EVAL in the like statement.
 
Reply With QuoteReport This Post
Platinum Member
posted Hide Post
You left out the words AND COMPUTE .
eg.
AND COMPUTE SUB_CENTER/A3 = EDIT(&CENTER, '999*');
 
Posts: 226 | Registered: June 08, 2003Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Pietro De Santis:
[qb] ... LIKE '&SUB_CENTER.EVAL%'; ...
[/qb]
.EVAL is not necesary here, and can cause problems if &CENTER's value contains an ampersand.

You need something to avoid interpretation of the "%" as part of the & parameter's name. In cases like this (where an & name abuts a non-blank character that can be part of an & name), use "|" to delimit the & name, as in:

LIKE '&SUB_CENTER|%';
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Parsing an amper variable

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.