×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Function

Function

Function

(OP)
can anyone help me writing and calling a function with some parameters. here's wht i know
DEFINE FUNCTION fname(par1,par2)
....
...can i use it with some where clause using master file and return something

END
how can i call fname? to print the returned value.

RE: Function

You can return a value by setting the function equal to something. For example,

DEFINE FILE sample
WORK/i5=fname(par1,par2);
END

You can use IF, but I don't think you can use WHERE.

RE: Function

(OP)
Thanks Pete,
I think I have to figure out some other way. I have to access same MAS file for different where conditions and with same parameter values. so i thought I can use a function.
Thanks again for ur time
-P

RE: Function

Sounds like you may want to use Dialogue Manager. DM can alter code based on different conditions. For example, a menu with & variables can be used to tell DM how to build code for a TABLE.

RE: Function

(OP)
hOW TO USE DIALOGUE MANAGER. I dont see it in any of my tools and options on my webFOCUS Desktop developer studio 4.3.6
Please let me know

RE: Function

I don't remember developer studio dealing much with DM code, but you can insert the code yourself. You probably need to get a Focus manual. A simple example would be; if &REQUEST is 'A', I want to report on FIELD1. Otherwise, I want to use FIELD2. So...

TABLE FILE SAMEFILE
-SET &WORK=IF &REQUEST IS 'A' THEN 'FIELD1' ELSE 'FIELD2';
SUM &WORK
END

DM code can put intelligence into an application, but it can also get very complicated and extensive. It can READ, WRITE, DECODE, IF-THEN-ELSE, GOTO, call functions, default values, etc. That's why you need a manual.

RE: Function

Sample is

If you write in edasprpf the following

DEFINE FUNCTION WAYMD(INDATE/I8,ADD/I8,FMT/A2)
  D01/A3=DOWK(INDATE,'A3');
  D02/I8=AYMD(INDATE,ADD,'I8');
  D03/I8=IF (D01 NE ' ') AND (D02 EQ 0) THEN 20031231 ELSE D02;
  D04/A8=EDIT(D03);
  D05/A8=IF FMT EQ 'I6' THEN EDIT(D04,'$$999999') ELSE D04;
  WAYMD/I8=EDIT(D05);
END

You can
-SET &X=WAYMD(20031230,1,'I8'); in dialog

X/I8=WAYMD(20031230,1,X);

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close