IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Accepting parameters.
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Platinum Member
Posted
Hi,

I have a situation where I need to accept a paramter then reformat it and use in the where clause so that the result set from the database is small. Here is the example.

BY
HH_CUST_NUM
WHERE ( CB_MAJ_ACCT_NUM EQ '00004' );
WHERE ( BILL_YEAR EQ '&ENTER_YEAR.Enter the year.' );

BILL_YEAR is a defined field. I want to accept
the year in ccyy format from the user and create a
variable using ENTER_YEAR in the MM/DD/YY format.
Instead of BILL_YEAR I want to use my database field so that I can force the FOCUS to use database fiedl in the where clause.

Any help is appreciated.
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Reply With QuoteEdit or Delete MessageReport This Post
Silver Member
Posted Hide Post
To do what you want, you will need to manipulate the input source year to become a full date value. Here is the code:



DEFINE FILE EMPLOYEE
ND/YY = &INPUT_YEAR;
ND1/YYMD=ND;
NEWDT/I8MDYY = DATECVT(ND1, 'YYMD', 'I8MDYY');
END
TABLE FILE EMPLOYEE
BY NEWDT
PRINT EMP_ID LAST_NAME
END


The above converts the year to a full YYMD format, which is set to Jan 1 of the year entered. Then use DATECVT to covert it back to a legacy date (Integer) field in the format of your choice.

This message has been edited. Last edited by: <Mabel>,
 
Posts: 40 | Location: New York City | Registered: May 23, 2004Reply With QuoteEdit or Delete MessageReport This Post
Guru
Posted Hide Post
Try to avoid manipulating input values as DEFINEd fields. Defined fields are evaluated once for every row of extracted data. Do the manipulation with Dialog Manager Variables.

Try

-PROMPT &ENTER_YEAR.Enter the year.I4.
-SET &TEST_DATE = '01/01/' |
- EDIT(&ENTER_YEAR,'$$99') ;

(if you want the 4 char year just use &ENTER_YEAR)

and in the WHERE statement

WHERE db_date GE '&TEST_DATE';
 
Posts: 342 | Location: Melbourne Australia | Registered: April 15, 2003Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Accepting parameters.

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