Unknown Field or Variable Name

Posted by burnmw on 08-Jul-2011 09:39

** Unknown field or variable name - dsNotes LINE 10 (Of below snippet)

I'm receiving this error, and yet my variable (dsNotes) is declared only a few lines above this code. Quick Code Snippet:

1:   DEFINE DATASET dsNotes FOR ttNotes.

2:

3:   CONSTRUCTOR PUBLIC oaNotes( ):

4:       SUPER().

5:       InitializeComponent ( ).

6:       GetNotes().

7:   END CONSTRUCTOR.

8:

9:   METHOD PRIVATE VOID GetNotes():

10:     rtfNotesBox:DataBindings:Add("Text",dsNotes:HANDLE,"ttNotes.ttextStr").

11: END METHOD.

So, as you can see I am defining my dataset, but it is still saying it doesn't know what it is. Has anybody got any idea what I might be doing wrong?

Thanks in advance!

All Replies

Posted by Håvard Danielsen on 08-Jul-2011 10:06

Static dataset references need to be qualified with the dataset keyword. This applies to many static constructs. This is necessary because the ABL allows similar names to be used for these different constructs.

The example below is all valid syntax.

--

define temp-table dsNotes field dsNotes as char.
define dataset dsNotes for dsNotes.
define query dsNotes for dsNotes.
define variable dsNotes as char no-undo.
define frame dsNotes dsNotes.

---

The compiler allows unqualified references for variables and fields, with variables taking presedence over fields and TT fields taking presendece over a db field.

---

rtfNotesBox:DataBindings:Add("Text",dataset dsNotes:HANDLE,"ttNotes.ttextStr")

Message was edited by: Havard Danielsen

Note that my comment is explaining the error message ** Unknown field or variable name - dsNotes. Using the correct reference should enable DataBindings:Add to give a more meaningful error message... If you want this to work you better follow Peter's explanation below.

Posted by Peter Judge on 08-Jul-2011 10:11

rtfNotesBox:DataBindings:Add("Text",dsNotes:HANDLE,"ttNotes.ttextStr"

You cannot bind directly to a dataset in GUI for .NET. You must use a ProBindingSource object instead (in the toolbox under OpenEdge Controls).

-- peter

Posted by burnmw on 14-Jul-2011 05:27

Thanks to both Peter and Havard for your answers. Between you and some further reading of my own I managed to solve it. I was trying to do it without using a BindingSource, this was of course wrong and it is so much easier to use one!

This thread is closed