473,378 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Extracting from Long Binary field

I'm wondering if anyone has come across something like this before and could
offer some suggestions.

I need to extract all the Single values packed in a Long Binary field (4k
chunks) and then export to Excel.

The challenge is arranging the values in columns and rows so they can be
exported and land in Excel properly for charting. The way the data is
packed in the LB field can be illustrated like this:

1 3 5 2 4 6 7 9 11 8 10 12

I have to get this series of values into 2 tables looking like this:

1 | 3 | 5
7 | 9 | 11

2 | 4 | 6
8 | 10 | 12

In reality it's more complicated, but the idea is separating the series
based on every 3rd (or Nth) value in the series, and stacking them up in
columns (N is variable and has to be inferred by other parameters). After I
get the values into a table the way I want them, I can easily dump it out to
Excel.

What I'm experimenting with now looks something like this:

Const CHUNKSZ = 4
Do While Not rstTd.EOF
lngOffset = 0
Set colTd = New Collection
lngBsize = LenB(rstTd!MeasData)
ReDim abytB(lngBsize)
abytB = rstTd!MeasData.GetChunk(0, lngBsize)
lngMid = rstTd!MeasurementId
Do While lngOffset < lngBsize
CopyMemory sngBval, abytB(lngOffset), 4
colTd.Add sngBval
lngOffset = lngOffset + CHUNKSZ
Loop
'insert values into table here
Set colTd = Nothing
rstTd.MoveNext
Loop

Once the values are extraced into colTd, I pass the collection to another
function that massages the data into a table based on whatever the layout
requirements are.

But how to split the series of values on every Nth item in the collection?
Is this something that could be done with SQL based on an Autonumber ID in
the table? Other suggestions?

Thanks in advance.
Nov 13 '05 #1
2 2091
The letters are an abstraction.

tblPackedBinary:
AutoID Data
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H
9 I
10 J
11 K
12 L
13 M
14 N
15 O
16 P
17 Q
....

qrySieve:
SELECT tblPackedBinary.AutoID, 4 AS n, IIf((AutoID + [n] - 1) Mod
2*[n]>= [n],"OddGroup" & CStr((AutoID - 1) \ (2 * [n]) + 1),"EvenGroup"
& CStr((AutoID - 1) \ (2 * [n])) + 1) AS Category, tblPackedBinary.Data
FROM tblPackedBinary;

! qrySieve:
AutoID n Category Data
1 4 OddGroup1 A
2 4 OddGroup1 B
3 4 OddGroup1 C
4 4 OddGroup1 D
5 4 EvenGroup1 E
6 4 EvenGroup1 F
7 4 EvenGroup1 G
8 4 EvenGroup1 H
9 4 OddGroup2 I
10 4 OddGroup2 J
11 4 OddGroup2 K
12 4 OddGroup2 L
13 4 EvenGroup2 M
14 4 EvenGroup2 N
15 4 EvenGroup2 O
16 4 EvenGroup2 P
17 4 OddGroup2 Q
....

If '3 As n' is used instead of '4 As n':
! qrySieve:
AutoID n Category Data
1 3 OddGroup1 A
2 3 OddGroup1 B
3 3 OddGroup1 C
4 3 EvenGroup1 D
5 3 EvenGroup1 E
6 3 EvenGroup1 F
7 3 OddGroup2 G
8 3 OddGroup2 H
9 3 OddGroup2 I
10 3 EvenGroup2 J
11 3 EvenGroup2 K
12 3 EvenGroup2 L
13 3 OddGroup3 M
14 3 OddGroup3 N
15 3 OddGroup3 O
16 3 EvenGroup3 P
17 3 EvenGroup3 Q
....

Maybe qrySieve can help reduce the problem you have into a simpler one.

James A. Fortune

Nov 13 '05 #2
Thanks for the reply. I ended up doing something similar.
tblPackedBinary:
AutoID Data
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H
9 I
10 J
11 K
12 L
13 M
14 N
15 O
16 P
17 Q
...

qrySieve:
SELECT tblPackedBinary.AutoID, 4 AS n, IIf((AutoID + [n] - 1) Mod
2*[n]>= [n],"OddGroup" & CStr((AutoID - 1) \ (2 * [n]) + 1),"EvenGroup"
& CStr((AutoID - 1) \ (2 * [n])) + 1) AS Category, tblPackedBinary.Data
FROM tblPackedBinary;

! qrySieve:
AutoID n Category Data
1 4 OddGroup1 A
2 4 OddGroup1 B
3 4 OddGroup1 C
4 4 OddGroup1 D
5 4 EvenGroup1 E
6 4 EvenGroup1 F
7 4 EvenGroup1 G
8 4 EvenGroup1 H
9 4 OddGroup2 I
10 4 OddGroup2 J
11 4 OddGroup2 K
12 4 OddGroup2 L
13 4 EvenGroup2 M
14 4 EvenGroup2 N
15 4 EvenGroup2 O
16 4 EvenGroup2 P
17 4 OddGroup2 Q
...

If '3 As n' is used instead of '4 As n':
! qrySieve:
AutoID n Category Data
1 3 OddGroup1 A
2 3 OddGroup1 B
3 3 OddGroup1 C
4 3 EvenGroup1 D
5 3 EvenGroup1 E
6 3 EvenGroup1 F
7 3 OddGroup2 G
8 3 OddGroup2 H
9 3 OddGroup2 I
10 3 EvenGroup2 J
11 3 EvenGroup2 K
12 3 EvenGroup2 L
13 3 OddGroup3 M
14 3 OddGroup3 N
15 3 OddGroup3 O
16 3 EvenGroup3 P
17 3 EvenGroup3 Q
...

Maybe qrySieve can help reduce the problem you have into a simpler one.

James A. Fortune

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bart plessers | last post by:
Hello, For a while I am working with ThumbsPlus ( http://www.cerious.com/ ) as manager for pics. The benefit of the program is that it stores all kind of information in a central Microsoft...
3
by: Randy | last post by:
I have heard that access 2003 has functions for dealing with Long Binary Data. Does anyone know if this is true? Background: I am using 2000 with a table linked to a SQL server. One of the fields...
2
by: silly | last post by:
/*Thanks again to thos who helped with my 'more hand written integer pow() functions (LONG POST)' query. I needed to write a function to write out integers and after looking at some stuff on...
17
by: James S. Singleton | last post by:
Let S be a pointer to a bytestring of length L. I would like to extract 4 bytes from S at the location p = S + d, with 0 < d < L - 4, and store them into an unsigned int. I am looking for...
36
by: Digital Puer | last post by:
Hi, suppose I have an unsigned long long. I would like to extract the front 'n' bits of this value and convert them into an integer. For example, if I extract the first 3 bits, I would get an int...
1
by: Dave | last post by:
Hello, I am wondering about including binary files in my MS Access database application. I want to keep my application as just a single MDE or MDB file, but the users of the app may need some...
35
by: fermineutron | last post by:
For a while now i have been "playing" with a little C program to compute the factorial of large numbers. Currently it takes aboy 1 second per 1000 multiplications, that is 25000P1000 will take...
0
by: Chris3000 | last post by:
Hi everyone How can I embeded an image to OLE Object field using Long Binary data. and what Long Binary data means and how to use it. does anyone have any ideas on I would to display...
5
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
I am trying to extract a zip file in a database image field to disk. For some reason, the zip file is getting corrupted / truncated. I have code in ASP which extracts the zip file no problem, so i...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.