UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Interval keys    
 
   
Vladimir
post Jun 2 2007, 03:54 AM
Post #1

UtterAccess Veteran
Posts: 347
From: Czech Republic, Praha



I'd like to know if A2007 has interval keys.

Imagine fldKey as a primary key:
fldKey fldValue
10 A
20 B
30 C
40 D

Any value <=10 should point me to A, values (>10 And <=20) should point to B,
etc.


TIA

Vlado
Go to the top of the page
 
+
Steve Schapel
post Jun 2 2007, 04:08 AM
Post #2

UtterAccess VIP
Posts: 3,881
From: New Zealand



Vlado,

I'm not sure if this is the kind of thing you mean. But you can make a table with two fields for the start and end values for the range, e.g.
fldValue fldStart fldEnd
A 0 10
B 10 20
C 20 30
D 30 40

Then, you can add this table to a query, where you have a number you want to return the corresponding fldValue, so in the criteria of the query you can put like this...
>[fldStart] And <=[fldEnd]

Just curious, does your fld prefix mean 'field'?
Go to the top of the page
 
+
Vladimir
post Jun 2 2007, 04:29 AM
Post #3

UtterAccess Veteran
Posts: 347
From: Czech Republic, Praha



TYVM for your respond, Steve. I know that there' an SQL solution for my problem. I'd appreciate interval keys anyway. ;-) We had interval keys & other goodies in PC FAND (DOS based relational database) very long time ago.

P.S. "fld" was meant as a prefix in table declaration:
fldKey (dbInteger)
fldValue (dbText,1)
Go to the top of the page
 
+
datAdrenaline
post Jun 2 2007, 04:40 PM
Post #4

UtterAccess Editor
Posts: 16,030
From: Northern Virginia, USA



You may want to investigate the use of the Partition() function ... it will return a string in the form similar to this:

10: 20

For numbers between 10 and 20 (if the parameters are passed correctly), then you can use string functions to parse out the first value then, you will have the "Parent" key.
Go to the top of the page
 
+
schroep
post Jun 2 2007, 10:27 PM
Post #5

UtterAccess VIP
Posts: 5,200
From: Denver, Colorado [USA]



I'm not aware of anything like this in any modern database.

SQL would generally be used.
Go to the top of the page
 
+
Vladimir
post Nov 5 2008, 09:44 PM
Post #6

UtterAccess Veteran
Posts: 347
From: Czech Republic, Praha



Back here after some time...

I've been investigating Partition function with no luck.
My scenario is:
1) I have lookup tables with a key field and two dates: PlatiOd and PlatiDo (DateStart and DateEnd).
2) Data table (Denik) has a field DATUUP and 9 fields pointing to various lookup tables with PlatiOd and PlatiDo.
3) Each key-field in Denik has its own lookup table.
4) I need to evaluate Denik.DATUUP and a key-field against an appropriate lookup table to get correct information, ie. values of other fields from the lookup table.

Example:
CODE
Cis3Uc04 (lookup table for SU)

SU   DPH    PlatiOd       PlatiDo

321  True   01.01.2008    31.12.2008  (CZ format for Dec 31 2008)

321  False  01.01.2009    31.12.2009

321  True   01.01.2010



Denik

DATUUP       SU

05.05.2008   321

09.09.2009   321

10.10.2010   321



SQL query should return something like this:

Denik.DATUUP    Denik.SU    Cis3Uc04.DPH

05.05.2008      321         True

09.09.2009      321         False

10.10.2008      321         True


It would be an easy task for a database with interval keys. But I can't make it work in "modern" Access.
Thank you very much for your time in advance.
Go to the top of the page
 
+
GroverParkGeorge
post Nov 6 2008, 01:33 AM
Post #7

UA Admin
Posts: 19,376
From: Newcastle, WA



"SQL query should return something like this"

The SQL solution Steve provided would work in YOUR SQL query. Just a thought.
Go to the top of the page
 
+
Vladimir
post Nov 6 2008, 04:36 AM
Post #8

UtterAccess Veteran
Posts: 347
From: Czech Republic, Praha



Thank you very much for your response.
I'm affraid the criteria won't work correctly since I need all records from Denik to be compared against Cis3Uc04.
Maybe I'm missing something.

I've created small demonstration DB, see the attachment. I'm not able to create a query that meets my needs (3 records in Denik should output 3 records in the query). I can't think about DLookups in the query since:
1) there may be >10.000 records in Denik a month
2) there are 9 lookup tables with DateStart and DateEnd (PlatoOd, PlatiDo)
3) there are other lookup tables that join Denik
Attached File(s)
Attached File  Period.zip ( 11.65K ) Number of downloads: 2
 
Go to the top of the page
 
+
mike60smart
post Nov 6 2008, 10:08 AM
Post #9

UtterAccess VIP
Posts: 8,549
From: Dunbar,Scotland



Hi Vlado

To retrieve the 3 records you need to have your structure somethinmg like the attached

tblDenik - PK - ID_Denik Autonumber
- linked to tblCis3Uc04 - FK - ID_Denik

Hope this helps?

Mike

Edited by: mike60smart on Thu Nov 6 10:09:26 EST 2008.
Attached File(s)
Attached File  Period.zip ( 17.73K ) Number of downloads: 2
 
Go to the top of the page
 
+
Vladimir
post Nov 6 2008, 01:05 PM
Post #10

UtterAccess Veteran
Posts: 347
From: Czech Republic, Praha



Hi,

TYVM for your response, Mike. Unfortunatelly, there's M:N relation, ie. M in Cis3Uc04, N in Denik. At the moment I'm trying "nested" query according to a post in one of Czech DB forums: http://forum.builder.cz/read.php?21,2804163. Suppose you speak Czech... (IMG:http://www.utteraccess.com/forum/style_emoticons/default/wink.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 12:00 PM