DBServer object doesn't allow :SetOrder

This forum is meant for questions and discussions about the X# language and tools
Post Reply
FdeRaadt
Posts: 31
Joined: Wed Sep 01, 2021 12:49 pm
Location: Netherlands

DBServer object doesn't allow :SetOrder

Post by FdeRaadt »

Hello All,

I've found something within my code that doesn't make sense.
I have the following code:

Code: Select all

if Upper(cDatapath)==cTESTDIR
	oKmTabel := Dbserver{"F:IC2TEST"+"KMTab16mp.adt", true, false, "ADSADT"}
else
	oKmTabel := Dbserver{cTracePad+"KMTab16.adt", true, false, "ADSADT"}
endif

oKmtabel:SetOrder("KM1")
Error: No Exported method 'SETORDER'

Within this code, we make a DbServer object using the SetOrder method as the controlling order.

I've looked into This post states that "If oServer is declared as DataServer then the method SetOrder is not available. So this will not compile." Robert 2018-12-07 11:03:01

But it does compile but leads to crashes upon calling the SetOrder method.

Now my solution that works for this problem is subclassing the DBServer class which still INHERITS from DBServer but magically works.
Can somebody explain to me why using the SetOrder method directly on a DBserver object doesn't work?

Frank
Attachments
oKmTabelDBSERVERklein.png
oKmTabelDBSERVERklein.png (164.81 KiB) Viewed 752 times
SetOrder.png
SetOrder.png (14.29 KiB) Viewed 752 times
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

DBServer object doesn't allow :SetOrder

Post by robert »

Frank,
How is oKmTabel declared ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FdeRaadt
Posts: 31
Joined: Wed Sep 01, 2021 12:49 pm
Location: Netherlands

DBServer object doesn't allow :SetOrder

Post by FdeRaadt »

LOCAL oKmTabel as object
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

DBServer object doesn't allow :SetOrder

Post by robert »

Frank,
If you declare a variable "as object" then the compiler does not know which methods exist.
So the error message is correct.
Change "as object" to "as dbserver" and the code will compile without errors.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBServer object doesn't allow :SetOrder

Post by Chris »

Hi Frank,

This should had worked fine, What is "oKmTabel" defined as?

Edit: Oh, I see you have already answered that. Since the error is the runtime one, something must have changed the type of the var in your code. Can you please post the complete code?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

DBServer object doesn't allow :SetOrder

Post by ic2 »

Hello Robert & Chris,

I created a very basic example which worked:

Code: Select all

		
local oKmTabel as object
oKmTabel := DbServer{"c:tempsomefile.dbf"}
oKmTabel:setorder("someorder")
The very same code didn't work in Frank's program. Then we noticed that In Frank's program the object was of XSharp.VO.SDK.DbServer while on my program it was XSharp.VO.DbServer.

Then I noticed that in my sample there was a reference to XSharp.Rdd while in Frank's program it was XSharp.VORDDClasses.

I think the latter is meant when working with no GUI, right? But it seems to be the cause. Using this reference instead of XSharp.RDD in the above code, SetOrder fails.

Any reason for that?

Dick
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBServer object doesn't allow :SetOrder

Post by Chris »

Hi Dick,

The XSharp.VO***Classes.dll files, are the new versions of the SDK libraries, which are typed and meant to be possible replacements to the regular VOSDK libraries at some point in the future. They are not fully compatible with the original classes (at least not yet) and are only distributed for evaluation for FOX subscribers only. What you need to use is the VO*Classes.dll libraries instead.

The library XSharp.Rdd is used automatically at runtime when needed and you do not need to have a reference to it in your projects.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

DBServer object doesn't allow :SetOrder

Post by ic2 »

Hello Chris,

Thanks for explaining.
Chris post=23285 userid=313 wrote:They are not fully compatible with the original classes (at least not yet)
Then it's probably good to log that SetOrder doesn't work there now?

It also explains why it did work when we changed Class dbServer to Class OurdbServerSubclass, as this subclass was defined in a library which referenced XSharp.RDD (as it should have been everywhere obviously).

Dick
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBServer object doesn't allow :SetOrder

Post by Chris »

Hi Dick,

Actually those classes do have SetOrder() defined, but the problem is that there multiple overloads and this causes this problem when trying to call it with late bound code. Anyway, those classes are not ready to be used in production, but we will overview them all when they get "officially" released some months later
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply