Pass Multiple vars with a function call

Pass Multiple vars with a function call

Postby Marc Venken » Fri Sep 08, 2023 9: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: Select all  Expand view
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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Pass Multiple vars with a function call

Postby nageswaragunupudi » Fri Sep 08, 2023 2:34 pm

Code: Select all  Expand view
(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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Pass Multiple vars with a function call

Postby Marc Venken » Fri Sep 08, 2023 2: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Pass Multiple vars with a function call

Postby Marc Venken » Fri Sep 08, 2023 2:50 pm

I'm using also this code

Code: Select all  Expand view

        // 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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 66 guests