problemi con Append()

Forum dedicato ai programmatori di X# in lingua italiana – Italian language forum

Moderator: wriedmann

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

Re: problemi con Append()

Post by Chris »

Hi Gian,

Thanks, but the code that you sent me is missing some bitmaps, a couple dlls (EPPlus.dll and XSharp.Tools.XlxsFile.dll) so I can't compile it, and you didn't tell me where I should put the dbf and rpt files, or where in the code the problem actually happens (it's hard to find this, just from the menu screenshot)

Also this is a 33,000 line program, isn't it possible to reproduce the problem it in a small (20-30 line) sample, that we can run here in both VO and X#, so we can see the difference and fix it in the X# side? If it's difficult for you to extract the relevant part of the app that produces the problem, I will try to do it myself, but I will need at least some "getting started" with your code directions, and of course all the necessary external dlls and bitmaps.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Gfb22
Posts: 105
Joined: Sat Oct 08, 2022 7:43 pm
Location: Italy

Re: problemi con Append()

Post by Gfb22 »

:-)
Chris,
You're right but it was to try not to give you too many problems...
Then I'll email you the working installation program and the VO AEF and some instructions file (you already have code #X)
Thank you!
gfb
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: problemi con Append()

Post by Chris »

Hi Gian,

So I guess I cannot hope at all that you will produce a small sample? :)
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Gfb22
Posts: 105
Joined: Sat Oct 08, 2022 7:43 pm
Location: Italy

Re: problemi con Append()

Post by Gfb22 »

:-) ...Ok: I'll send you the bare essentials to understand what I've done: I'll prepare it this evening.
Grazie!!!
gfb
gfb
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: problemi con Append()

Post by Chris »

Many thanks Gian!!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: problemi con Append()

Post by Chris »

Just to inform everybody following this thread, the problem appears to be a corrupted (or possibly incompatible) cdx index file, which VO does not mind about, while X# does not like. After a reindex (from either VO or X#), the code works fine also in the X# version, but Robert will have a look if that was indeed an index corruption or something that the X# RDD could had also handled but did not.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4540
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: problemi con Append()

Post by robert »

Guys,
The problem seems to be that the CDX contains an index on a Date field.
FoxPro indexes convert Dates to a Julian number and write that Julian number to the index as an 8 byte floating point number.
In the current version of the RDD, when you append a record and do not fill the date, then an error occurs because the conversion from an empty date to that Julian number fails (we use a DateTime as intermediate value, and the .Net DateTime class does not support empty DateTime values).

This will be fixed in 2.18

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Gfb22
Posts: 105
Joined: Sat Oct 08, 2022 7:43 pm
Location: Italy

Re: problemi con Append()

Post by Gfb22 »

Thanks Robert.
It is possible that the problem is really the indexes but, perhaps, not only on the DATA field. In my indexes the DTOS(Date Field) function is often present together with other keys.
Regard
gfb
gfb
User avatar
robert
Posts: 4540
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: problemi con Append()

Post by robert »

Gian,
In the example DBF the index is on "T_DATA". An index on "DTOS(T_DATA)" would behave quite differently because that expression results in a string and not a date.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Gfb22
Posts: 105
Joined: Sat Oct 08, 2022 7:43 pm
Location: Italy

Re: problemi con Append()

Post by Gfb22 »

Hi,
the problem with Append() is precisely due to the indexes: by reindexing with external programs (with the help of Chris) Append() no longer gives an error!
In the meantime, I try to modify all the keys that have a date field in the index to put DTOS(DATA), like other indexes that I already use...
Maybe that's enough for now?
=================
Other questions also related to indexes.
1) in the key of some indexes I put a condition to sort a number field
(Ex: T_TERZI + T_RIF + IIF(T_QUANT >=0, "A", "B") + DTOS(T_DATA).
T_QUANT is the quantity of a raw material and if >0 it is a loading, while if it is <0 it is an unloading, so as to have all the loadings first and then the unloadings.
How can we do better? Maybe it's better use the Str(..) function like: T_TERZI + T_RIF + STR(T_QUANT) + DTOS(T_DATA)?
2) In DataBrowser:Server it's better use the DBF file opened by the Owner or in the win itself?
Ex, in the Init(): self:Use(self:OWNER:oTab) or SELF:Use(tabella{}), where in the owner preinit() there is self:oTab := tabella{}?
3) To save the data, is it better to use a different instance of the DBF file, without order index or to use the DataBrowse server (after SuspendUpdate)?
4) ...and if a filter is active on the DataBrowser server, is it correct to call oServer:ClearFilter() every time and then put the filter back? I did some tests but the result was not good and the recorded record was not displayed in the DataBrowser until it was reinitialized.
Really thank you all!
gfb
gfb
Post Reply