Paradox Community

Items in pnews.paradox-programming

Subject:Re: Using library (from lsl) to get value from table and add to dynarray on form
Date:Thu, 07 Feb 2019 08:25:24 +0100
From:modridirkac <jure.zorko@gmail.com>
Newsgroups:pnews.paradox-programming
So you want to pass array from library to form?

1. declare array type on FORM in "type" block.
type
    DynRecord = DynArray[] AnyType
endType

2. declare method call on FORM in "uses" block
uses ObjectPAL
     GetSettings(var CardAr DynRecord) smallint
endUses

3. in LIBRARY declare "uses" block
type
    DynRecord = DynArray[] AnyType
endType

4. write medhod in LIBRARY
something like:
method GetSettings(var CardAr DynRecord) smallint
var TC TCursor
endVar
   if not TC.Open(":PRIV:globalcardinfo") then errorshow() return(-1) endIf
   if TC.nrecords() = 0 then
     TC.CLose()
     return(0)
   else
     TC.CopyToArray(CardAr)
     if TC."signaturereqamount" = "" then
       CardAr["signaturereqamount"] = 99
   endIf
   TC.close()
   return(1)
eneMethod


5. make a call on FORM to library
method SomethingOnMyForm() smallint
var l library
     CardAr DYnRecord
     ret smallint
endVar
   if not l.open("myLib") then errorshow() return(-2) endIf
   ret = l.GetSettings(CardAr)
   if ret < 0 then
     MsgStop("error",string(ret))
   else
     view(CardAr)
   endIf
   l.close()
return(ret)
endMethod


Jure

>
> Hi
>
> I am trying to add to dynarray(form) values from table using library.lsl.
>
>
> I can do this with library on form, but having diffculties using  
> library.lsl
>
>
> this is example of how I do it using library on form below.
> CardAr is dynarray[] anytype
>
> method zzGetSettingCard()  logical
>
> t.open(":PRIV:globalcardinfo")
> 	if t.nrecords() = 0 then
> 	else
> 	CardAr["merchantid"] = t.merchantid
> 	CardAr["processcard"] = t.processcard
> 	CardAr["addtipline"] = t.addtipline
> 		if t.signaturereqamount = "" then
> 			CardAr["signaturereqamount"] = 99
> 		else
> 			CardAr["signaturereqamount"] = t.signaturereqamount
> 		endif
> 	endif
> t.close()
>
>
> return true
> endMethod
>
> TIA
>
> Bob Shin


Copyright © 2004 thedbcommunity.com