Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has anyone here used View BlkGet?

Status
Not open for further replies.

JonathanCampbell

Programmer
Sep 27, 2013
13
US
Anyone have any experience with BlkGet? I really don't want to waste time getting the values cell by cell. I'm
putting the data into a DataTable row of objects, so it doesn't matter what type they are. I've tried every which way
to create the code for the BlkGet call (described as void AccpacView.BlkGet(ref object FieldIDs, out object pvalues))
but have had no luck doing so, with either object arrays or lists. I need a code fragment from working code, I'm obviously
missing something...

Thanks
Jon
 
Jon,

Here is some sample code. You can get the Field IDs from the Application Object Models.

Dim vGL As AccpacView
Dim Values As Variant
Dim i As Integer

mDBLinkCmpRW.OpenView "GL0001", vGL
vGL.GoTop
vGL.BlkGet Array(1, 2, 3), Values

For i = LBound(Values) To UBound(Values)
MsgBox Values(i)
Next

Hope this helps.

Kristi
 
Hello Kristi,

Thanks very much. I program in C#, but your model provides me with the assurance that I'll be able to
figure out how to make the compiler accept it (that is, int array and object array. I'll let everyone know.

Thanks again
Jon
 
Hard to believe what I found. BlkGet does work, but the two arrays that are its arguments must
be cast as simple objects, exactly specified as Visual Studio implied for the field ID and returned values
with Intellisense: (ref object, out object).
You then need to re-cast the result object (the returned value array) as an object array,
and then cast the results according to what the contents really are.

This is not worth the trouble, unless you have a huge number of columns and you need to get all of them.
And after all that, you still need to read the view row by row.

Cheers
Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top