473,563 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!Meas Data)
ReDim abytB(lngBsize)
abytB = rstTd!MeasData. GetChunk(0, lngBsize)
lngMid = rstTd!Measureme ntId
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 2113
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
1848
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 Database that easily can be manipulated. A thumbnail of the picture is also stored in de MDB as long binary (jpeg format) I made a small script that...
3
7193
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 is of type OLE Object. This table is populated from a website where excell spreadsheets are uploaded. But in the linked Access table instead of...
2
2592
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 the web I felt they look a bit code-heavy so... A) If you think the code attached is reasonable, consider it a donation, if not please lets have...
17
1834
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 suggestions on how to do this 1) In portable ANSI C. 2) As efficiently as possible. 3) Taking full account of the potential data alignment and endianness...
36
5264
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 between 0 and 7 (=2^3-1). Could someone please help out? I can assume the largest returned value fits in an int. Also, I'm on a big-endian PPC...
1
8175
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 additional files. One file is an ODBC driver for connecting to an external database, this is a 120 kb DLL. The other is a 20 kb PDF help document...
35
2699
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 about a second. It will be longer for 50000P1000 as expected, since more digits will be in the answer. Now, on the Num Analyses forum/Group there is a...
0
1608
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 images in my asp page. I am trying to insert the images in to MS Access using long binary data. so How can I insert a long binary data to ole object...
5
9117
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 know it is not corrupted in the table. Any help would be appreciated. FileStream fs = new FileStream(sFilePath + "TestFile.zip",...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.