473,396 Members | 1,676 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,396 software developers and data experts.

DISTINCT different files

12
Hello,

I have the following table:

U I AbsTime TypeOfFile
2 0.01 0000001 000001-D00
3 0.01 0000002 000001-D00
4 0.01 0000003 000002-D00
7 0.02 0000004 000003-D00
5 0.03 0000005 000001-D04
6 0.01 0000006 000002-D04
8 0.01 0000008 000001-D00
9 0.02 0000010 000001-D00

On my form i have a combo box which uses the following SQL code:

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT TableData.TypeOfFile FROM TableData WHERE (((TableData.TypeOfFile) Is Not Null)) ORDER BY TableData.TypeOfFile
This code lists, based on the table above, the following in the combo box:
000001-D00
000002-D00
000003-D03
000001-D04
000002-D04

The problem i have is that the second time a file of type 000001-D00 is read into the table (as seen above) my SQL code doesn't separate those from the other 000001-D00's that are already in the table.

I have written a function ReturnDate() that takes a time parameter for the current record and returns a date that is relative to a preset date. See Code below.

Expand|Select|Wrap|Line Numbers
  1. Public Function ReturnDate(T_End As Double) As Date
  2.  
  3. Dim FirstDate As Date    ' Declare variables.
  4. Dim IntervalType As String
  5. Dim T_Seconds As Double
  6. Dim T_start As Double
  7.  
  8. T_start = 815910630
  9.  
  10. IntervalType = "s"    ' "s" specifies months as interval.
  11. FirstDate = "2010-10-21 15:00"
  12. T_Seconds = T_End - T_start
  13. ReturnDate = DateAdd(IntervalType, T_Seconds, FirstDate)
  14.  
  15. End Function
What i would like to do is to extend the sql code so that the combo box would include a 'date-tag' so i wont miss out on file types of same type but from different dates. So with the new code the combo box would look something like this:

2011-02-02 000001-D00
2011-02-10 000001-D00
2011-01-01 000002-D00
2011-03-02 000003-D03
2011-02-02 000001-D04
2011-02-01 000002-D04

It is good enough if the first AbsTime record is sent in as parameter to the function for each type of file.

How would i go on doing this?

Any help is much appreciated, hope the explanation is clear.

Thanks heaps
Apr 4 '11 #1
3 1293
NeoPa
32,556 Expert Mod 16PB
Higgs:
The problem i have is that the second time a file of type 000001-D00 is read into the table (as seen above) my SQL code doesn't separate those from the other 000001-D00's that are already in the table.
Does this mean that the value appears twice in your ComboBox? Otherwise I have no idea what you're trying to say here. Maybe you want it to appear twice? I'm confused. I'm guessing with very little info that makes sense, so it's better I wait for clarification.
Apr 4 '11 #2
Higgs
12
Yes, i will try to clarify;

Assume i have a folder containing 1000 files of a certain type i.e 000001-D00. After reading those into my table i get the next folder which might contain files of type 000002-D00. After that i might have a third folder that contains an identical file type which already have been read into the table, so the file type 000001-D00 may occur again.

The field with file types may look something like this;

TypeOfFile
000001-D00
.
.
.
000001-D00
000002-D00
000002-D00
.
.
000002-D00
000001-D00
.
.
000001-D00

Files with same 'names' may contain different data so they are all of interest. ALlthough when displaying my files in the combo box i want it to be easily overviewed whats available within the table. Since there are going to be millions of records of the same file type i would like to group all the file types, but, where the same file type have been read in multiple times (multiple sequences) i want to separate those from eachother and therefore i thought it would be handy to use the datefunction since i have a time field for each record.

I hope this makes it more clear, otherwise please ask me to try again :)

Cheers
Apr 5 '11 #3
NeoPa
32,556 Expert Mod 16PB
Before you just talked about records in a table, but now you've introduced files in folders. Unfortunately, although I can probably guess (sort of) how these interrelate, you don't actually say so. This leaves me with more jig-saw pieces to fit into the puzzle than I started with. Unfortunate, but you've clearly made an effort, and I do actually appreciate how complicated most people find laying information out so that it can be understood by someone who doesn't actually have access to it themselves. So let me see if I can make some intelligent guesses to fill in the gaps and you can tell me if I'm too far off piste.

I think you probably have (many many) records with data which includes a field [TypeOfFile] as well as another DateTime field [FirstDate]. You are looking to aggregate (group by and report values that cover the groups) bunches of records which have the same [TypeOfFile] value, as well as [FirstDate] values whose date parts match. Assuming my assumption is correct then you might try :
Expand|Select|Wrap|Line Numbers
  1. SELECT   [TypeOfFile]
  2.        , DatePart([FirstDate]) AS [FileDate]
  3. FROM     [TableData]
  4. WHERE    ([TypeOfFile] Is Not Null)
  5. GROUP BY [TypeOfFile]
  6.        , DatePart([FirstDate])
  7. ORDER BY [TypeOfFile]
  8.        , DatePart([FirstDate])
Apr 7 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Markus Keuthmann | last post by:
I want to export all images from the DB2 sample database (sample) in different files. My export-statement: db2 "export to G:\images\emp_photo.del of del lobs to G:\images\ lobfile image...
3
by: Martijn | last post by:
Hi, I have come unto a situation where two source files of one project contain similar functions with the same name (it reads settings from a file and thus named FetchSettings). When I...
1
by: Rico Rivera | last post by:
I have two files: FileA.vb FileB.vb FileA.vb contains the following sample code: NameSpace SomeNamespace Public Class SomeClassA Public Shared Function MethodA() As String
3
by: WaterWalk | last post by:
I read from c99 std TC2 community draft, and found the following statement in 6.7.2.3: "Tw o declarations of structure, union, or enumerated types which are in different scopes or use different...
13
by: Kavi | last post by:
I was hoping any javascript and asp gurus may help me with this problem, o.k well here it is.... i have a form, which has a user and password, that a user enters when i want to submit this...
1
by: Mark Denardo | last post by:
Ok here's my problem: I have a bunch of Classes at the same namespace level say "abc.xyz". And all Classes reside in different files. abc.xyz.Class1 (in Class1.vb) abc.xyz.Class2 (in...
1
by: gomzi | last post by:
Hi, I would like to know as to how one could access a function having a same name but in different files. i.e. is there a way of specifying the name of the file so that the function could be...
12
realin
by: realin | last post by:
hi guys, I have a php file say "class.php" in which a database class is defined. I have got another file namely "config.php" which initializes its object as require_once("class.php");...
3
by: ajd335 | last post by:
Hi all, I am using Microsoft 's query analyzer. My query results in a huge number of data. I wanted to store first 500 records into one file.E.g result1.csv and other 500 into result2.csv and so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.