Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Runtime Error: Wrong field specification, why? 13 Jan 2022 12:26 #21098

  • Alf
  • Alf's Avatar
  • Topic Author


  • Posts: 42
  • Hi to all,
    some of my users (only few) get a runtime error "wrong field specification" when a simple FIELDGET() is executed on a DBF. Mostly this happens when the field type is LOGIC. But I am sure: the field type is really correct (of course I checked this!). When I let me send this specific DBF and test it on one or all of my machines: No error, no problem. Very strange!
    Thanks for any help!
    Alf

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

    Last edit: by Alf.

    Runtime Error: Wrong field specification, why? 13 Jan 2022 12:40 #21100

    • robert
    • robert's Avatar


  • Posts: 2593
  • Alf,
    What is the name of the field?
    Could it be that the field has the same name as a property (access) of the server class ?
    For example, "Status", "Name" ?

    Robert
    XSharp Development Team
    The Netherlands

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

    Runtime Error: Wrong field specification, why? 13 Jan 2022 13:12 #21101

    • Alf
    • Alf's Avatar
    • Topic Author


  • Posts: 42
  • Robert,
    I guess, this can't be the reason. The field names are very specific, like "KLR", "STRFREI21".
    May be incorrect installation? To find out this, now I let me send the content of the program directory.
    By the way: In the start method of all my appls I call a function which test all DBF structures and all field properties (name, type, length) and compare them with my data dictionary. This function does no detect any inconsistency on the concerning
    users machine.
    Alf

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

    Last edit: by robert.

    Runtime Error: Wrong field specification, why? 13 Jan 2022 14:37 #21102

    • Jamal


  • Posts: 269
  • Alf,

    I suggest you check if the DBF alias or dbServer is the correct one that you are doing the FIELDGET() on.

    One way to find out is to override the FIELDGET method and trap the error to return the Alias; that way you can tell for sure what alias or workarea is being used, then trace your code to find out where the issue is coming from.


    Jamal

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

    Runtime Error: Wrong field specification, why? 13 Jan 2022 15:32 #21104

    • Alf
    • Alf's Avatar
    • Topic Author


  • Posts: 42
  • Robert and Jamal,
    now I found the reason for my troubles.
    In VO: When I set "Setdefault(...)", the DBFs always will be opened (respectively created) in this default directory, so I never have to complement a path to the DBF name.
    In XSharp: When I set "Setdefault(...)", the DBFs will be opened (respectively created) in this default directory only, if there exists no DBF with the same name in the program directory.
    The behavior in XSharp seems to be different to VO (?).
    The disadvantage is: If the user copies or moves DBFs in the program directory (for some unknown reason), I get a real problem. Ok, I can complement GetDefault() in any USE- or CREATE-Statement, but this seems to be a little laborious and dangerous. I'm meditating for a better solution.
    Alf

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

    Last edit: by Alf.

    Runtime Error: Wrong field specification, why? 13 Jan 2022 16:12 #21105

    • Jamal


  • Posts: 269
  • Alf,

    How about also , in addition to SetDefault(), calling SetPath() to point to the same folder?

    Jamal

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

    Last edit: by Jamal.

    Runtime Error: Wrong field specification, why? 13 Jan 2022 21:42 #21108

    • ic2


  • Posts: 1221
  • Hello Alf,

    Alf wrote: The disadvantage is: If the user copies or moves DBFs in the program directory (for some unknown reason), I get a real problem. Ok, I can complement GetDefault() in any USE- or CREATE-Statement, but this seems to be a little laborious and dangerous. I'm meditating for a better solution.



    I would say that if you have users who move dbf files they have a problem, not you. There is no solution for stupidness.

    We open every dbf using a global cDataPath which is assigned in settings. But if someone decides to move dbf files that won't work either.

    Dick

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

    Runtime Error: Wrong field specification, why? 13 Jan 2022 23:33 #21110

    • Chris
    • Chris's Avatar


  • Posts: 2957
  • Guys,

    Since the behavior is indeed different in X# than in VO (I have confirmed that) and it's not something in the framework preventing X# to have the same behavior with VO, then this is considered a bug. I have opened a ticket for it: github.com/X-Sharp/XSharpPublic/issues/908

    Thanks for the report and for looking into it everybody!
    XSharp Development Team
    chris(at)xsharp.eu

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

    Runtime Error: Wrong field specification, why? 14 Jan 2022 11:20 #21111

    • Alf
    • Alf's Avatar
    • Topic Author


  • Posts: 42
  • Chris, Jamal, Dick,
    thanks to all for answers.
    @Dick: You are right, but everything the users can do wrong, they do it (my experience in 25 years software development).
    @Jamal: Good idea, but does not work in my test.
    @Chris: For the moment, I added a function in all my start methods, which looks for DBFs (and CDXs) in the program directory and moves them in a dummy directory.
    Alf

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

    • Page:
    • 1