FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Pass Multiple vars with a function call
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Pass Multiple vars with a function call
Posted: Fri Sep 08, 2023 09:55 AM
I have the folowing code and the point is the second variable (document and cData)

cData in this case "document" is the fieldname that is used to search for : value is 12345

this works great for 1 field values but i also need this for a combination field like

upper(document)+upper(paid). The index is already build for the 2 var's but I can't get them correct in the cData from the function MyScope

Code (fw): Select all Collapse
oBrw[2]:bChange    := { || MyScope("factinfo","document","factart","factart"),oBrw22:refresh() }

oBrw[2]:bChange    := { || MyScope("factinfo","upper(document)+upper(paid)","factart","factart"),oBrw22:refresh() }  // off cource this does not work, but this is how I would like to use it

function MyScope(cParent,cData,cChild,cChildTag)
  LOCAL cZoekdata:= upper( (cParent)->&cData)
  LOCAL aScope1, aScope2
  DEFAULT cFoto:=""

  if cZoekdata = sys_scope
     return NIL
  endif
  sys_Scope = cZoekdata

  (cChild)->(dbsetorder(cChildTag))

  (cChild)->(ORDSCOPE(0, "" ) )
  (cChild)->(ORDSCOPE(1, "" ) )

  (cChild)->( ORDSCOPE(0, cZoekData ) )
  (cChild)->(ORDSCOPE(1, cZoekData ) )
  (cChild)->(DBGOTOP())

Return NIL
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Pass Multiple vars with a function call
Posted: Fri Sep 08, 2023 02:34 PM
Code (fw): Select all Collapse
 (cChild)->(dbsetorder(cChildTag))

  (cChild)->(ORDSCOPE(0, "" ) )
  (cChild)->(ORDSCOPE(1, "" ) )

  (cChild)->( ORDSCOPE(0, cZoekData ) )
  (cChild)->(ORDSCOPE(1, cZoekData ) )
  (cChild)->(DBGOTOP())
Such long code can be avoided by using SCOPED RELATIONs.
I will try to give you a sample.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Pass Multiple vars with a function call
Posted: Fri Sep 08, 2023 02:39 PM
nageswaragunupudi wrote:
Such long code can be avoided by using SCOPED RELATIONs.
I will try to give you a sample.
That would be very very nice because my entire systems depend on this !!!
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Pass Multiple vars with a function call
Posted: Fri Sep 08, 2023 02:50 PM
I'm using also this code
Code (fw): Select all Collapse
        // sample 1
        select (cMaster)
        set relation to upper(klant_nr) into facturen scoped ADDITIVE
        select (cDbf)
        // sample 2
        ( cMaster )->( ORDSETRELATION( "factart" , { || document }, "document" ) )
If you mean this technique ? that i'm using.
Marc Venken

Using: FWH 23.08 with Harbour

Continue the discussion