Jump to content


Photo
- - - - -

Help need with Global Calling


17 replies to this topic

#1 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 November 2005 - 07:36 AM

I've been trying to get my head around this for the past couple of days and i'm getting more and more lost, and my poor head is starting to hurt :D

Our company is trying to write a scheduler for reporting and outstanding transactions etc. Now here comes the part that fries my noodle :

I have global report X containing 5 Input parameters, what fields they are I don't know. Our parameters aren't standardised to be only valid field names, so I cant use field definitions to find out which file they reside in.

Now I also have global report Y that only has 3 Input parameters.

In report X, Parameter 4 is the same as Y's parameter 1. Now at some stage in this process, data that needs to be passed and be validated. How could this be done effectively without having to write validation screens for every single report thats on the system (Dynamic Field Validation ?) ?

Then my next problem, calling the reports. The only way that I can think of doing this, is to almost setup my own function directory of what reports are available. When a certain time/date is reached, this funtion directory gets read, does a case statement to check what function is being called, and then does a global_lscall to the appropriate function. Is there any other possible way of doing this as this involves a far amount of maintenance ?

Anyone got some bright ideas on how to achieve this or how not to do it ?

#2 Phil

Phil

    Expert

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male

Posted 11 November 2005 - 09:58 AM

I don't envy you Neil - that hurt my head just reading that.

#3 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 November 2005 - 10:07 AM

Hahaha :D

This is one of those thinking out of the box problems ;)

#4 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 696 posts
  • Location:Rural France

Posted 11 November 2005 - 11:19 AM

Can't make much sense of your OP Neil.
Can you try and restate what you're trying to achieve in a clearer way?
Nothing's as simple as you think

#5 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 November 2005 - 11:59 AM

Sorry Richard, its Friday. I need to draw pictures to make it easier to understand :lol:

The idea is the following:

Using a normal update function

I have a global report X. With parameters A,B,C,D and E.
I also have a Global Report Y. With parameters F,G and A.

We then want to create a scheduling process that can be setup, using Pro4 only, to do what users want run on a monthly basis. EG. They want a sales report for division XYZ run every month for certain criteria. Basically i'm looking for a one size fits all solution, whereby a single screen is used to setup whats needed by the various reports

Problems that I see
you can't call a global function dynamically ie $FUNCT = 'W.TEST'; GLOBAL_LSCALL($FUNCT)
knowing what parameters to pass to global functions

How do I achieve this without

A) having to write screen selections for each report
B) having huge amounts of parameter maintenance

Does that make some sort of sense ?

#6 Chris Pepper

Chris Pepper

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 369 posts
  • Gender:Male
  • Location:United Kingdom

Posted 11 November 2005 - 12:15 PM

It looks like you are constrained by having to use existing Global Functions.

The design we used to use here passed parameters to reports using a data record. The outer LR of the report was a one time read to this temporary record, keyed on a number passed in a COM Variable (or it could be in a Global Function parameter). This meant that the Report was decoupled from the calling Function.

If you are trying to call existing Global Functions then you'll be restricted to using a CASE statement. The number of parameters is irrelevant as you'll be calling each one with a different interface number presumably i.e. GLOBAL_LSCALL(REPORT1,10001) , GLOBAL_LSCALL(REPORT2,10002) - assuming they haven't changed the format of GLOBAL_LSCALL in the latest versions?

#7 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,640 posts
  • Gender:Male
  • Location:Spain

Posted 11 November 2005 - 12:31 PM

Hi,

You will have to do something like....

CASE $FUNCTION
WHEN 'FUN1' : GLOBAL_LSCALL(FUN1,0001)
WHEN 'FUN2' : GLOBAL_LSCALL(FUN2,0002)
WHEN 'FUN3' : GLOBAL_LSCALL(FUN3,0003)
ENDCASE

Is that what you mean??

Rob D.

#8 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 November 2005 - 12:41 PM

It looks like you are constrained by having to use existing Global Functions.

The design we used to use here passed parameters to reports using a data record. The outer LR of the report was a one time read to this temporary record, keyed on a number passed in a COM Variable (or it could be in a Global Function parameter). This meant that the Report was decoupled from the calling Function.

If you are trying to call existing Global Functions then you'll be restricted to using a CASE statement. The number of parameters is irrelevant as you'll be calling each one with a different interface number presumably i.e. GLOBAL_LSCALL(REPORT1,10001) , GLOBAL_LSCALL(REPORT2,10002) - assuming they haven't changed the format of GLOBAL_LSCALL in the latest versions?

Thanks Chris

That give me a few ideas

WRT the calling functions. The problem is not in the calling, more in setting up what gets sent to the global function. How do I setup and validate my parameters dynamically ? eg

Function X
Parameter A
Parameter B
Parameter C
Parameter D
Parameter E

Function Y
Parameter F
Parameter G
Parameter A

I need to be able to setup, validate and pass parameters for both of these functions from 1 source. So in an input screen I would setup the call to function X. But Parameter A needs to be validated against file Q. I need to do the exact same validation to setup the call to function Y.


:lol:

#9 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 November 2005 - 12:43 PM

Hi,

You will have to do something like....

CASE $FUNCTION
WHEN 'FUN1' : GLOBAL_LSCALL(FUN1,0001)
WHEN 'FUN2' : GLOBAL_LSCALL(FUN2,0002)
WHEN 'FUN3' : GLOBAL_LSCALL(FUN3,0003)
ENDCASE

Is that what you mean??

Rob D.

Not really Rob, that part I have covered and understand that I would need to do that because of how ProIV's global calls work.

I think I need to draw some pictures for what i'm trying to achieve. Looks like I suck at explaining myself :lol:

#10 Mike Schoen

Mike Schoen

    Expert

  • Members
  • PipPipPipPip
  • 198 posts
  • Gender:Male
  • Location:Guelph, Canada

Posted 11 November 2005 - 01:56 PM

What about exitting directly to the global report function itself, instead of using a global_lscall?

Report functions can then do something like this:
IF @CURFUNCT = @FUNCT THEN
call global update to get run variables from pre-defined file
and set variables to input vars
@LFUNCT = @PFUNCT
@EFUNCT = @PFUNCT
ENDIF

You will no doubt still have to write a setup screen that understands each functions's parameters, and prompts for and validates them.

#11 Kevin Bruss

Kevin Bruss

    Expert

  • Members
  • PipPipPipPip
  • 113 posts
  • Gender:Male
  • Location:Oklahoma City, OK

Posted 11 November 2005 - 05:24 PM

As far as the com variables go, it might be easier to write them to a scratch file (ie, from the exit of your screen) and read them back (via LSCALL in logic in of your reports) if in this special 'cron' mode..

This process is similar to that of "ProGenda"; a once-free automated reporting tool for Glovia/Chess.. I've made a couple of my own custom brewed versions and once implemented, the users find them handy.

-Kevin

#12 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 696 posts
  • Location:Rural France

Posted 11 November 2005 - 06:12 PM

Still not sure I understand you Neil :lol:

Are you maybe saying you know "Parameter A" is, for example, customer code in both cases and that you want to write some kind of "generic" user interface that lets users schedule a "job" (ie. some report) AND then prompts them for and validates the parameters appropriate to that "job" based on some "job definition"? (Maybe you were thinking of trying to infer correct validation from the variable names used as global report function parameters??)

Yeah, it's Friday here too B)
Nothing's as simple as you think

#13 Glenn Meyers

Glenn Meyers

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 221 posts
  • Gender:Male
  • Location:St. Louis, MO, United States
  • Interests:I also raise African Gray Parrots and build hot rod automobiles.

Posted 11 November 2005 - 06:21 PM

Forty two.

#14 Joseph Bove

Joseph Bove

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 756 posts
  • Gender:Male
  • Location:Ramsey, United States

Posted 12 November 2005 - 03:05 AM

Neil,

Problems that I see
you can't call a global function dynamically ie $FUNCT = 'W.TEST'; GLOBAL_LSCALL($FUNCT)
knowing what parameters to pass to global functions

How do I achieve this without

A) having to write screen selections for each report
having huge amounts of parameter maintenance


I think I finally got what you're saying. End User Sally goes to your screen and specifies something like:

Day Time Report Parameters
Sunday 3:00 AM SA_RGION XYZ, HA, 17
Friday 5:00 PM JC_TCARD XYZ, ALL, ALL, ALL, Y
etc.

If I'm on the correct track, I think that the easiest solution would be to have your routine write an update function dynamically to call the reports. It is relatively easy to write a function that writes an update. Your report selection could then be limited to the reports that you've built code generating business logic for.

Actually, in writing this, I'm starting to think of doing this myself...

Regards,

Joseph

#15 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 14 November 2005 - 07:36 AM

Neil,


Problems that I see
you can't call a global function dynamically ie $FUNCT = 'W.TEST'; GLOBAL_LSCALL($FUNCT)
knowing what parameters to pass to global functions

How do I achieve this without

A) having to write screen selections for each report
having huge amounts of parameter maintenance


I think I finally got what you're saying. End User Sally goes to your screen and specifies something like:

Day Time Report Parameters
Sunday 3:00 AM SA_RGION XYZ, HA, 17
Friday 5:00 PM JC_TCARD XYZ, ALL, ALL, ALL, Y
etc.

If I'm on the correct track, I think that the easiest solution would be to have your routine write an update function dynamically to call the reports. It is relatively easy to write a function that writes an update. Your report selection could then be limited to the reports that you've built code generating business logic for.

Actually, in writing this, I'm starting to think of doing this myself...

Regards,

Joseph

Joseph that's exactly what i'm looking for. Yay at least someone understands me :lol: So create a function that creates a global update which calls a global report ?

Richard, yeah you got the gist of it. I'm looking to write a generic interface that could be used for all reporting. Basically so that I have one screen that will hoepfully cater for all selection criteria whatever it may be. How to achieve this is another story



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users