fbpx
Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1
  • 2

TOPIC: Moving to X# and the winner is...

Moving to X# 3 months 2 weeks ago #8896

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
Hi, I've looked everywhere that I can think of logically for these questions, so I'll leave it here.

Take for example, this VO 2.8 code which I have poseted here before:

METHOD Start() CLASS App
LOCAL oServer as DbServer
local aDBF as array
Local cDir
cDir := WorkDir() + "Invoices\"
DirMake(cDir)
cDir := WorkDir() + "Filters\"
DirMake(cDir)
cDir := WorkDir() + "Original Reports\"
DirMake(cDir)

request dbfcdx
RddSetDefault("DBFCDX")
Set Decimals to 2


// Create Client Database and Indexes
aDBF := {}
AAdd(aDBF, {"ClCode", "C", 10, 0})
AAdd(aDBF, {"ClName", "C", 100, 0})
AAdd(aDBF, {"ClAdd1", "C", 100, 0})
AAdd(aDBF, {"ClAdd2", "C", 100, 0})
AAdd(aDBF, {"ClState", "C", 3, 0})
AAdd(aDBF, {"ClSuburb", "C", 50, 0})
AAdd(aDBF, {"ClPhone", "C", 10, 0})
AAdd(aDBF, {"ClPcode", "C", 4, 0})
AAdd(aDBF, {"ClABN", "C", 20, 0})
AAdd(aDBF, {"ClEmail", "C", 100, 0})
AAdd(aDBF, {"ClComments", "M", 10, 0})
DBCREATE("CLIENT", aDBF, "DBFCDX")
oServer := DbServer{"Client"}
oServer:CreateOrder("CLCode", "Client","CLCode",,.T.)
oServer:CreateOrder("CLName", "Client", "ClName")
oServer:CreateOrder("ClState", "Client", "ClState")
oServer:CreateOrder("CLPcode", "Client", "ClPCode")
oServer:Commit()
oServer:Close()



//Create Details Database and Indexes
aDBF := {}
AAdd(aDBF, {"ClCode", "C", 10, 0})
AAdd(aDBF, {"ClName", "C", 100, 0})
AAdd(aDBF, {"Dname", "C", 50, 0})
AAdd(aDBF, {"JobDate", "D", 10, 0})
AAdd(aDBF, {"JobFin", "L", 1, 0})
AAdd(aDBF, {"JobTime", "C", 10, 0})
AAdd(aDBF, {"JobDetails", "M", 10, 0})
AAdd(aDBF, {"NPC", "M", 10, 0})
AAdd(aDBF, {"JobNumber", "C", 5, 0})
AAdd(aDBF, {"PONumber", "C", 15, 0})
AAdd(aDBF, {"Rate", "N", 10, 2})
AAdd(aDBF, {"Units", "N", 10, 2})
AAdd(aDBF, {"RateType", "C", 15, 0})
AAdd(aDBF, {"Subby", "C", 50, 0})
AAdd(aDBF, {"Rego", "C", 50, 0})
AAdd(aDBF, {"Invoiced", "L", 1, 0})
AAdd(aDBF, {"InvFile", "C", 250, 0})
AAdd(aDBF, {"MapFile", "C", 250, 0})
DBCREATE("Details", aDBF, "DBFCDX")
oServer := DbServer{"DETAILS"}
oServer:CreateOrder("CLCode", "Details", "CLCode" )
oServer:CreateOrder("JobDate", "Details", "JobDate")
oServer:CreateOrder("JobFin", "Details", "JobFin")
oServer:CreateOrder("JobNumber", "Details", "JobNumber")
oServer:CreateOrder("PONumber", "Details", "PONumber",, .T.)
oServer:CreateOrder("Subby", "Details", "Subby",, .T.)
oServer:CreateOrder("Rego", "Details", "Rego")
oServer:CreateOrder("Invoiced", "Details", "Invoiced")
oServer:CreateOrder("InvFile", "Details", "InvFile")
oServer:CreateOrder("MapFile", "Details", "MapFile")
oServer:Commit()
oServer:Close()


//Create JobNumber Database
aDBF := {}
AAdd(aDBF, {"JobNumber", "N", 5, 0})
DBCREATE("JobNo", aDBF, "dbfcdx")
oServer := DbServer{"JobNo"}
oServer:CreateOrder("JobNumber", "JobNo","JobNumber")
oServer:APPEND()
oServer:FIELDPUT(#JobNumber, 0)
oServer:Commit()
oServer:Close()



// Create Rates Database and Indexes
aDBF := {}
AAdd(aDBF, {"RateType", "C", 10, 0})
DBCREATE("Rates", aDBF, "DBFCDX")
oServer := DbServer{"RATES"}
oServer:APPEND()
oServer:FIELDPUT(#RateType, "Each")
oServer:APPEND()
oServer:FIELDPUT(#RateType, "Hourly")
oServer:APPEND()
oServer:FIELDPUT(#RateType, "Quoted")
oServer:APPEND()
oServer:FIELDPUT(#RateType, "Zone")
oServer:Commit()
oServer:Close()


// Create Configuration File Database
aDBF := {}
AAdd(aDBF, {"FromEmail", "C", 100, 0})
AAdd(aDBF, {"TermDays", "N", 3, 0})
AAdd(aDBF, {"EOM", "N", 3, 0})
AAdd(aDBF, {"CLName", "C", 100, 0})
AAdd(aDBF, {"ABN", "C", 15, 0})
AAdd(aDBF, {"Add1", "C", 100, 0})
AAdd(aDBF, {"Add2", "C", 100, 0})
AAdd(aDBF, {"Suburb", "C", 50, 0})
AAdd(aDBF, {"State", "C", 3, 0})
AAdd(aDBF, {"Pcode", "C", 4, 0})
AAdd(aDBF, {"Phone1", "C", 20, 0})
AAdd(aDBF, {"Email", "C", 100, 0})
AAdd(aDBF, {"TandC", "M", 10, 0})
DBCREATE("BMConfig", aDBF, "DBFCDX")

FCopy("BMInvoice.rpt", cDir + "BMInvoice.rpt")
FCopy("Blank Invoice.rpt", cDir + "Blank Invoice.rpt")
FCopy("JobNumber.rpt", cDir + "JobNumber.rpt")
FCopy("JobList.rpt", cDir + "JobList.rpt")
FCopy("WorkSheet.rpt", cDir + "WorkSheet.rpt")
FCopy("Client Details.rpt", cDir + "Client Details.rpt")

self:Quit()

Return self


I cannot see anywhere how to recode that (or something giving the same result) using X#. Is is possible? If so, how please.

I don't expect you to rewrite the entire code, just add pointers where I'm going wrong. These are just some of the errors I'm getting on compiling:

error XS9003: Pre-processor: Include file not found: 'VOSystemLibrary.vh' 4,10 Start1.prg SdiApp1
error XS9003: Pre-processor: Include file not found: 'VOSystemClasses.vh' 5,10 Start1.prg SdiApp1
error XS9002: Parser: unexpected input '{#' 337,13 Start1.prg SdiApp1
error XS9002: Parser: unexpected input '}' 337,24 Start1.prg SdiApp1
error XS9002: Parser: mismatched input 'AS' 340,14 Start1.prg SdiApp1
error XS9002: Parser: unexpected input 'RETURN' 342,9 Start1.prg SdiApp1
error XS9002: Parser: mismatched input '(' expecting EOS 342,29 Start1.prg SdiApp1
Compilation failed (7 errors)

The Return error, I'm thinking is just a complier switch, and the first two are ok also.. Others I have had say that Arrays are not applicable in X# core, dbDServer namespace error etc.

Thanks again.

Please Log in or Create an account to join the conversation.

Last edit: by BiggyRat.

Moving to X# 3 months 2 weeks ago #8898

  FFF's Avatar FFF Offline Posts: 640
Jeff,
* pls attach the zipped solution to test.
EDIT:
Started Xide, made a new SDIApp1 from samples, as probably you did (?), went to properties and clicked "Console" to see my outputs...
Now, put this in Start.prg
FUNCTION Start( asCmdLine AS STRING[] ) AS INT
//METHOD Start() CLASS App
LOCAL oServer AS DbServer
LOCAL aDBF AS ARRAY
LOCAL cDir
? cDir := WorkDir() + "Invoices\"
/*DirMake(cDir)
cDir := WorkDir() + "Filters\"
DirMake(cDir)
cDir := WorkDir() + "Original Reports\"
DirMake(cDir)*/
wait
RETURN 1

Compiles and runs showing:
C:\Dev\XIDE\Projects\4\Bin\Debug\Invoices\

Now, to proceed with your DBFCDX, you HAVE to have VN runtime on your machine, as DBFCDX is not (yet) part of the runtime. If not, the CreateOrder part CAN'T work.

Karl
Regards
Karl

Please Log in or Create an account to join the conversation.

Last edit: by FFF.

Moving to X# 3 months 2 weeks ago #8899

  wriedmann's Avatar wriedmann Offline Posts: 1683
Hi Jeff,

this code should compile in X# as it is, but you have to wait for the DBFCDX RDD to be ready.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Moving to X# 3 months 2 weeks ago #8914

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
Sorry, my bad. I must have copied the wrong piece of code. The result is still the same though...

On a completely unrelated subject... why are viaef files allowed to be uploaded while vimef files are not? Just an oversight maybe?
Attachments:

Please Log in or Create an account to join the conversation.

Moving to X# 3 months 2 weeks ago #8915

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
Sorry, but your code Karl Returns:

error XS0246: The type or namespace name 'DbServer' could not be found (are you missing a using directive or an assembly reference?) 3,7 Start1.prg SdiApp1
Compilation failed (1 error)

Please Log in or Create an account to join the conversation.

Last edit: by BiggyRat.

Moving to X# 3 months 2 weeks ago #8916

  lumberjack's Avatar lumberjack Offline Posts: 518
Jeff,

BiggyRat wrote: Sorry, but your code Karl Returns:
error XS0246: The type or namespace name 'DbServer' could not be found (are you missing a using directive or an assembly reference?) 3,7 Start1.prg SdiApp1
Compilation failed (1 error)

A search in the X# help file on DbServer class:
DbServer Class 
Create a data server that can operate with existing .DBF database files and their associated index files.
Inheritance Hierarchy
Object
  DataServer
    DbServer
Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.0
You need to have a reference to this Assembly in your application...
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Moving to X# 3 months 2 weeks ago #8917

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
Aren't I doing that? If anything, I'm referencing far too much surely?
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by BiggyRat.

Moving to X# 3 months 2 weeks ago #8918

  lumberjack's Avatar lumberjack Offline Posts: 518
Jeff,

BiggyRat wrote: Aren't I doing that? If anything, I'm referencing far too much surely?

Yes, drop all those Vulcan*.dll references, you not needing any Vulcan stuff, but then add VORDDClasses.dll etc.
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Moving to X# 3 months 2 weeks ago #8919

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
OK Johan,

With just 4 references, I get (see 4refs.jpg):

error XS0246: The type or namespace name 'DbServer' could not be found (are you missing a using directive or an assembly reference?) 25,7 Start1.prg SdiApp1
Compilation failed (1 error)

Without the two Vulcan references shown in 4Refs.jpg, I get:
error XS9014: The dialect 'VO' requires a reference to the runtime DLLs VulcanRT.DLL and VulcanRTFuncs.DLL or XSharp.Core.DLL and XSharp.RT.DLL.
Compilation failed (1 error)
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by BiggyRat.

Moving to X# 3 months 2 weeks ago #8920

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
OK. For those of you playing along at home, the winning combination in this round of X# Lotto are
System
VORDDClasses
VOSystemClasses
XSharp.core
and
XSharp.RT

How'd you go at home?

However! It now gives me this.... (see attachment)
Attachments:

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8921

  lumberjack's Avatar lumberjack Offline Posts: 518
Hi Jeff,

BiggyRat wrote: OK. For those of you playing along at home, the winning combination in this round of X# Lotto are

I have added XSharp.VO and still no resolve...

However
AAdd(aDBF, {"JobDate", "D", 8, 0}) // Note the magic 8 instead of 10
Did the trick...
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8922

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
But this code still fails...

FUNCTION Start AS VOID
// declare typed array of aDatabases objects
LOCAL aDbf AS ARRAY
//LOCAL oServer AS DBServer
// Initialize the array with the "normal" array syntax
aDbf := {}

aDBF := {}
AAdd(aDBF, {"ClCode", "C", 10, 0})
AAdd(aDBF, {"ClName", "C", 100, 0})
AAdd(aDBF, {"ClAdd1", "C", 100, 0})
AAdd(aDBF, {"ClAdd2", "C", 100, 0})
AAdd(aDBF, {"ClState", "C", 3, 0})
AAdd(aDBF, {"ClSuburb", "C", 50, 0})
AAdd(aDBF, {"ClPhone", "C", 10, 0})
AAdd(aDBF, {"ClPcode", "C", 4, 0})
AAdd(aDBF, {"ClABN", "C", 20, 0})
AAdd(aDBF, {"ClEmail", "C", 100, 0})
AAdd(aDBF, {"ClComments", "M", 10, 0})
DBCREATE("CLIENT", aDBF, "DBFNTX")
// oServer := DbServer{"Client"}
// oServer:CreateOrder("CLCode", "Client",.T.)
/* oServer:CreateOrder("CLName", "Client", "ClName")
oServer:CreateOrder("ClState", "Client", "ClState")
oServer:CreateOrder("CLPcode", "Client", "ClPCode")
oServer:Commit()
oServer:Close()

*/

RETURN

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8923

  lumberjack's Avatar lumberjack Offline Posts: 518

BiggyRat wrote: But this code still fails...

Jeff, do you get an error or what is the fail?
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8924

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
Hi Johan, yes I get a runtime error, attached in my X# lottery post.

Whilst on the subject Johan, have any other field defaults changed that I'm unaware of? I'm assuming for example, memo fields are still 10?

Please Log in or Create an account to join the conversation.

Last edit: by BiggyRat.

Moving to X# and the winner is... 3 months 2 weeks ago #8925

  lumberjack's Avatar lumberjack Offline Posts: 518

BiggyRat wrote: Hi Johan, yes I get a runtime error, attached in my X# lottery post.
Whilst on the subject Johan, have any other field defaults changed that I'm unaware of? I'm assuming for example, memo fields are still 10?

Jeff, no changes, D was always 8 YYYYMMDD, M 10.
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8926

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
Yes of course, I think I'm just a little bamboozled at the minute. That error messgae is:
Attachments:

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8928

  lumberjack's Avatar lumberjack Offline Posts: 518

BiggyRat wrote: Yes of course, I think I'm just a little bamboozled at the minute. That error messgae is:

If you look at your references are they all loaded from the GAC?
______________________
Johan Nel
George, South Africa
Attachments:

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8929

  BiggyRat's Avatar Topic Author BiggyRat Offline Posts: 197
They were, but that since changed. As the error didn't change, I didn't think it was going to make a huge difference. Anyway, here are the latest screenshot and entire code

Code:

FUNCTION Start AS VOID
// declare typed array of aDatabases objects
LOCAL aDbf AS ARRAY
//LOCAL oServer AS DBServer
// Initialize the array with the "normal" array syntax
aDbf := {}

aDBF := {}
AAdd(aDBF, {"ClCode", "C", 10, 0})
AAdd(aDBF, {"ClName", "C", 100, 0})
AAdd(aDBF, {"ClAdd1", "C", 100, 0})
AAdd(aDBF, {"ClAdd2", "C", 100, 0})
AAdd(aDBF, {"ClState", "C", 3, 0})
AAdd(aDBF, {"ClSuburb", "C", 50, 0})
AAdd(aDBF, {"ClPhone", "C", 10, 0})
AAdd(aDBF, {"ClPcode", "C", 4, 0})
AAdd(aDBF, {"ClABN", "C", 20, 0})
AAdd(aDBF, {"ClEmail", "C", 100, 0})
AAdd(aDBF, {"ClComments", "M", 10, 0})
DBCREATE("CLIENT", aDBF, "DBFNTX")
// oServer := DbServer{"Client"}
// oServer:CreateOrder("CLCode", "Client",.T.)
/* oServer:CreateOrder("CLName", "Client", "ClName")
oServer:CreateOrder("ClState", "Client", "ClState")
oServer:CreateOrder("CLPcode", "Client", "ClPCode")
oServer:Commit()
oServer:Close()

*/

RETURN


Compiler:

Compilation successful!




RUNTIME: See Runtime screenshot and File Locations.
Attachments:

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8930

  lumberjack's Avatar lumberjack Offline Posts: 518
Hi Jeff,
I think that is your problem. It looks first for the .dll 's in the Application folder then in the GAC.
Change the references to the GAC for all, then it will run.
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

Moving to X# and the winner is... 3 months 2 weeks ago #8931

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 326
Hi Jeff,

check in the XIDE Application property window -> tabpage "General" the platform radiobuttons. The platform must be "x86"

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2