WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: JTaylor on June 13, 2022, 07:57:13 PM

Title: ArrInfo()
Post by: JTaylor on June 13, 2022, 07:57:13 PM
If I use option -1.   Should it always return a false if it can't read an array, for whatever reason?   I am getting the 1637 "Error Accessing Array Data" message instead, which seems like an invalid array to me.   Have been trying to see what is coming back but no luck so far.  It should be a MAP from the SDK.   It works at least once, sometimes more, but then I encounter this error on subsequent calls.   I can't display or write to a file because it is not a string.   ObjectTypeGet() returns a blank string.   Binary Functions didn't help either.   Suggestions?

Jim
Title: Re: ArrInfo()
Post by: td on June 13, 2022, 11:18:59 PM
That error means that the variable you are passing in has the type VARTYPE_ARRAY but the array descriptor stored in the WIL variable defining structure is nonexistent.
Title: Re: ArrInfo()
Post by: JTaylor on June 14, 2022, 08:33:05 AM
I realize this isn't a very good question but, any ideas on how to trouble-shoot/fix the problem?   I have a list box of items and when I click on one it calls a function which retrieves some data and places that in a Map in my Extender.   I click on an item and it works.  I click on another item and it often works.  I click back on the original item and it generates this error.   If it didn't work at all it would be easier to track down but it always works the first time and often the second.  Since it fails on an item that works the first time I am reasonably sure it isn't the data but I displayed that at the point of query and it looks fine.   I have error trapping at every point of the Map creation code.   I have displayed the data prior to populating the vipervar variable and it all looks good.   My variables are initialized the start of every call.  Just not sure what else to try.

Thanks for the reply.

Jim
Title: Re: ArrInfo()
Post by: JTaylor on June 14, 2022, 09:10:18 AM
I also used the IsMap() function from the Map Extender Example and it passed that test.  Assuming I used it correctly.

jim
Title: Re: ArrInfo()
Post by: td on June 14, 2022, 11:09:02 AM
You are likley stepping on a variable's contents but I it is impossible say much more about it.

{edit} You have done that to array variables before if memory serves...
Title: Re: ArrInfo()
Post by: JTaylor on June 14, 2022, 02:30:47 PM
You know me so well :)

Everyone extols the virtue of using ByReference calls but so far they have done nothing but cause problems that I spend days trying to fix.

Thanks again.

Jim
Title: Re: ArrInfo()
Post by: ChuckC on June 14, 2022, 06:33:19 PM
Passing arguments by reference is a *good* thing.  Always avoid spurious class object instantiation and copy c'tor / copy operator invocation.

Unintentionally altering the content of an argument passed by reference is a *bad* thing.

There ends the preamble as delivered by Mr. Obvious.

I'm almost idiotically O.C.D. with usage of things like "const &<type>" in C++, along with the "noexcept" specifier on class methods.  If you are strict enough with specifying the contract involved, you can make it such that violation of the contract involves code that engages in obviously deliberate suicide via [dirty] type casts and such.
Title: Re: ArrInfo()
Post by: JTaylor on June 14, 2022, 07:42:15 PM
Yeah...so far I have only created the bad part of the by reference stuff, apparently.

Thought I had this solved.  The function with which I was encountering the problem now works fine after I removed the by reference stuff.   Another function that basically does the same thing in the creation of a Map now has the problem.   Oddly enough, I think it worked before but not certain.

Oh well, I am not very bright but I am persistent.  It will eventually give up and work in the face of my implacable will  ;)

Jim