As a Xojo newbie, I’m not yet used to the nuances of the language.
This one I find really vague:
This code results in an error:
“There is more than one item with this name and it’s not clear to which this refers”
I’ve seen this message before as I’ve been learning and it seems to me that this a data type error.
row.Column sounds/seems generic. But it is a String type. I was trying to pass an integer value to it because I didn’t know the columns were data aware. I didn’t notice the autocomplete options until just now.
I looked around the docs for DatabaseRecord and found all the column types. I was annoyed that Column doesn’t say StringColumn or TextColumn… whatever. .
I know I made this post look like a complaint about the poverties of the DatabaseRecord object, but it’s about the error message it returns.
It should have said “row.Column expects a String, Integer given.”
What if you change your generic “row” property name to something like “dbRecord”. I’ve seen instances where the use of a reserved word or property name in another method or module can cause something similar depending on the scope of both items.
As Tim said + a more meaningful (for you) Property Class Name is welcome.
What row Class is ?
Entry_DBR, for example, can be more meaningful than simply row, isnt it ?
Category.CategoryType.ID = an Enumeration?
If so, try to use this:
Category.CategoryType.ID = Integer(Category.CategoryType.ID)
@derk: I tried that first
(it’s an db Id value, so it’s type is Interger)
I also tried Category.CategoryType.ID = Integer.Parse (Category.CategoryType.ID).
When I tried integer.parse, I got told by Parse() that it expected a String and that made me wonder what type row.Column expected. That led me to the correct way to use this.
I’m mainly complaining about the error message. Interestingly, Integer.Parse’s error message was perfect - it told me exactly what was wrong.
If you looked at Parse in the LR you knew how wrong use it was
The error is that there is one or more overloaded methods with this name, but none of them match the signature you are trying to use.
DatabaseRecord.Column(Name As String) As String
DatabaseRecord.Column(Index As Integer) As String
DatabaseRecord.Column(Name As String, Assigns value As String)
In your case, you needed one where the Assigns parameter took an integer.
As a Xojo user of some years I still find this error message “There is more than one item with this name and it’s not clear to which this refers” very obtuse. I’m guessing there was a Starwars fan there somewhere who had a passion for Yoda talk.
Er no. The message is correct English usage if somewhat obscure. But it’s obscurity is another matter.
I think it is a very misleading message for new users to Xojo. No matter which method was used out of those available, the call would never fit so the message displayed should be noting that, not that there are some more, which this implies that it could fit if you just picked another, it’ll never fit without a cast.
In VS, you get errors like this, with a lot more information, a clear indication of the issue and a button that will try to fix the issue for you (oh we can dream):