xsharp.eu • DBServer object doesn't allow :SetOrder
Page 1 of 1

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 10:58 am
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

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 11:20 am
by robert
Frank,
How is oKmTabel declared ?

Robert

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 11:28 am
by FdeRaadt
LOCAL oKmTabel as object

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 11:36 am
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

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 11:36 am
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?

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 1:34 pm
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

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 1:43 pm
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.

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 5:02 pm
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

DBServer object doesn't allow :SetOrder

Posted: Fri Aug 12, 2022 10:07 pm
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