** 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.
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!
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.
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
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!