Jump to content


Photo
- - - - -

Function Call


9 replies to this topic

#1 Bharat

Bharat

    Advanced

  • Members
  • PipPipPip
  • 52 posts
  • Gender:Male
  • Location:India

Posted 14 November 2005 - 07:59 AM

I would like to know is it possible to do a Function call from Global Update.

Regards

#2 Rob Donovan

Rob Donovan

    rob@proivrc.com

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

Posted 14 November 2005 - 08:12 AM

Hi,

What do you mean by 'Function call'??

Call another global function?

If so, its just ....

GLOBAL_LSCALL(FUNNAME,0001)

HTHs,

Rob D.

#3 Bharat

Bharat

    Advanced

  • Members
  • PipPipPip
  • 52 posts
  • Gender:Male
  • Location:India

Posted 14 November 2005 - 08:23 AM

Let me restate my question

Update A -> calls GLOBAL_UPDATE('B'). Can i do a function call 'C' using @LFUNCT or using EXIT LINK from 'B'.

Regards
Raj

#4 Rob Donovan

Rob Donovan

    rob@proivrc.com

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

Posted 14 November 2005 - 09:17 AM

Hi,

Nope, Function B must finish and return to Function A first.

Then, back in function A, you can set @LFUNCT or do another GLOBAL_LSCALL....

Exit links for Global Functions do not work. They always return to the calling function.

Rob D.

#5 Rick Young

Rick Young

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 265 posts
  • Gender:Male
  • Location:Guelph, Canada

Posted 14 November 2005 - 02:09 PM

Having said that, you can @LFUNCT to a Global.

Eg. Non-global Screen function MYMENU - @LFUNCT = OPTION1, where OPTION1 is a Global Screen does work. I've found this useful when wanting to have the same screen called directly as well as from (say) an F4.

I have not attempted to call from an actual Menu type.

#6 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 14 November 2005 - 02:26 PM

I'm not sure what this would be used for, but what if you did the following:

in your calling function (to the global)
LSCALL C_GLUFUN
IF $_G2FUN # '' THEN
@LFUNCT = $_G2FUN
FNEXIT EXIT
ENDIF

Then, in your interface section of C_GLUFUN, return $_G2FUN as to what you'd like it to go to..
I forget if exit logic is processed or not in the calling function, so if necessary you might need an extra condition to exit if $_G2FUN is set.

-Kevin

#7 Rob Donovan

Rob Donovan

    rob@proivrc.com

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

Posted 14 November 2005 - 02:34 PM

Hi,

After looking at it more you can actually set @LFUNCT in the global and then do an FNEXIT.

This will make the Global exit and then the calling function exit also, to @LFUNCT.

However, for code readabillity and debugging I would not recomend this approach, as it could be hard to follow.

Rob D.

#8 Wim Soutendijk

Wim Soutendijk

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 211 posts
  • Gender:Male
  • Location:Netherlands

Posted 14 November 2005 - 02:47 PM

Be also aware that if you FNEXIT from a global function, if you are on SQL you must first do a COMMIT, or your data will be lost.

#9 Richard Bassett

Richard Bassett

    ProIV Guru

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

Posted 14 November 2005 - 03:37 PM

Having said that, you can @LFUNCT to a Global.
Eg. Non-global Screen function MYMENU - @LFUNCT = OPTION1, where OPTION1 is a Global Screen does work. I've found this useful when wanting to have the same screen called directly as well as from (say) an F4.

Whaat!? Have you ever found anything that says that's supported Rick? Does it only work if there are no function parameters? What happens if there are parameters?

Be also aware that if you FNEXIT from a global function, if you are on SQL you must first do a COMMIT, or your data will be lost.


Whaat!? Is that documented anywhere Wim? I cannot imagine that would be the intended behaviour.
Did you really mean any type of global function at any time or are you talking about "borderline" cases in screen processing?

However, for code readabillity and debugging I would not recomend this approach, as it could be hard to follow.

Whaa..oops ^H^H^H^H^H^H^H^H, I'd agree with that for "normal" processing, but for "exception" processing where something has gone detectably wrong it can be quite valuable.

FNEXIT EXIT

Surely there is never any need to follow an FNEXIT with an EXIT?
Nothing's as simple as you think

#10 Rick Young

Rick Young

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 265 posts
  • Gender:Male
  • Location:Guelph, Canada

Posted 14 November 2005 - 03:56 PM


Whaat!?  Have you ever found anything that says that's supported Rick?  Does it only work if there are no function parameters?  What happens if there are parameters?

No - and in fact, the last ProIV trainer that we had visit reflected something like "you can do that?!"

I have used them with and without parms. In the case of one with parms, have to fiddle IF $INCOMING.PARM = "" THEN $INCOMING.PARM = @$COM1(1,12); or something similar. Though now I think about it - it would probably (possibly?) work using type E.

I have not had occasion to use one with either O or B type parms.

In each case, it was simply where an inquiry screen "typically" called from a menu, was now desired to be used within another function.

Do I advocate using something that is a) undocumented and :lol: surprises a ProIV representative? :-"


-Rick



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users