You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

nbarakat

Beginner

  • "nbarakat" started this thread

Posts: 11

Date of registration: May 24th 2010

  • Send private message

1

Wednesday, May 26th 2010, 12:43pm

Compiling Function with Optional Keyword produces error

Hello All,



When compiling the following function within a class, compiler Error is generated with the message Auto convertion currency to double is not supported. Without the Optional keyword, the statement gets copiled fine.



Source code

1
2
3
Public Function DistributeOutwardShares(PPE As Currency, LPE As Currency, PRR As Currency, LRR As Currency, Premium As Currency, Interest As Currency, DROEPRR As Currency, DROELRR As Currency, DROEASO As Currency, Claim As Currency, CashClaim As Currency, Commission As Currency, OtherCharges As Currency, PPO As Currency, LPO As Currency, PRW As Currency, LRW As Currency, Brokerage As Currency, XLCA As Currency, ProfitCommission As Currency, IsTaxable As Boolean, InwardSerial As Long, GNPI As Currency, blnError As Boolean, StrStaPrdFromDat As String, Liability As Currency, Optional OSAmount As Currency, Optional TaxableCalculatedPremium As Currency) As Variant 

End Function

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Wednesday, May 26th 2010, 1:35pm

Currency not really mature in Jabaco

Yes, this looks like an error.
Your workaround would be to use "double" rather than "Currency" as type.

I've noticed that the "cCur()" function in Jabaco is returning a "long" rather than a "Currency" value.
However, Currency seems to be implemented as "double" in Jabaco.

To find out if an optional parameter is actually specified, VB6 offers a function "isMissing()".
This appears not to be available in Jabaco. Therefore, you have to use a default value for optional parameters.

My last remark is about your high number of 28 function parameters.
You might want to use a user-defined TYPE and pass all parameters in one go rather than writing them all in a row.

Success!

A1880

nbarakat

Beginner

  • "nbarakat" started this thread

Posts: 11

Date of registration: May 24th 2010

  • Send private message

3

Wednesday, May 26th 2010, 2:35pm

Thanks A1880 for your feedback. Very helpful. Changing to double seems to compile with no issues.



Since you seem to be very involved in this project, are you aware if anyone is working on an ADO wrapper for Jabaco?



Thanks again and I will probably be posting many questions as I get myself familiar with the product.

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

4

Wednesday, May 26th 2010, 3:51pm

Hi,
no, an ADO wrapper is probably not being worked on,
but you may get hits asking Google for Java and ADO.
In Jabaco, it is more natural to use JDBC for database access.
JDBC is rather similar to ADO. Give it a try!
Please search this forum using "recordset", "database" or "jdbc" as keys.
There are numerous samples and explanations.

ADO is based on ActiveX. It is possible to access ActiveX from Jabaco using frameworks like "Jacob" (Java COM Bridge).
But this usually turns out to be fairly complicated.

Happy experimenting!

A1880

Rate this thread
WoltLab Burning Board