473,396 Members | 2,020 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.

Boolean or Table

zmbd
5,501 Expert Mod 4TB
I have two tables that I will be taking the cartesian product to get all of my possible combinations (right now that will return some 40 results); however, I will have an occation where I need to restrict the over all results to just a combination of a select group of records from each table (a subgroup of eight).

My first thought was a boolean field in each table and return only the cartesian product where both fields are true; however, my second thought is to use two more tables joined to restrict.

Thoughts?
Jan 13 '14 #1
8 1817
Rabbit
12,516 Expert Mod 8TB
What would these 2 other tables contain and how is the subgroup of 8 chosen?

If you can avoid the joins, that would be best. But if the extra joins mean you eliminate the manual process of checking which records you want to join, then that could be better. With such small records counts, I think the 2 extra joins won't be too big a resource hog if it eliminates a manual process.
Jan 13 '14 #2
zmbd
5,501 Expert Mod 4TB
tbl_one - a series of desciptions. Being a lab, four of these are "standards", actually - five
Control, Desc1, Desc2, Desc3, Desc4... this is the current in the table; however, this could expand to have 12 to 100 entries in total

tbl_two - a scale, Here I've a PK, Scale1995, Scale2010
This one is tricky: the Scale used in 1995 is different than 2010; however related. The Scale in 2010 is 1 thru 10 inclusive. Here I need just the values 2 and 8 for the subgroup

1-10:Control have no meaining, there can only be a 0:Control
0:DescN has no meaning as the numeric is a scalar reference to the difference from the control for that property.

{2:Desc1, 8:Desc1; 2:Desc2, 2:Desc2;... 2:DescN, 8:DescN} is the subgroup that would be used as the "scale/calibration" standards.

The analitical reasults however may return a 0:Control or a 1-10:DescN.

I'm not anticipating either the scalar nor the descriptions used for the calibration to change; however, the scale has changed at least once, hence the 1995 field for cross reference with legacy data, and at one point we only used the control and Desc1 as our calibrator; thus, I'm tring to make it future proofed.
Jan 13 '14 #3
Rabbit
12,516 Expert Mod 8TB
I think I need to see some sample data. I'm having trouble grasping some of the concepts.
Jan 13 '14 #4
zmbd
5,501 Expert Mod 4TB
Here's the basic idea:

(mind you right now, this is all in an excel workbook (@.@)
Try pulling a 30/60/90 day rolling average.... arrrrghghgh

We calibrate the method using the control, we need a zero point, and then control+adulterants at the scalar 2 and scalar 8 degree of difference from control, of the dozens of adulterants out there, we use only 4: desc1...desc4.

Expand|Select|Wrap|Line Numbers
  1. So to calibrate:
  2. tbl_callogbook
  3. [pk]...[calid]............[scalar]...[property]...[pass]
  4. [1]....[201401_001_001]...[0]........[Control]....[true]
  5. [2]....[201401_001_002]...[2]........[Desc1]......[true]
  6. [3]....[201401_001_003]...[8]........[Desc1]......[true]
  7. [4]....[201401_001_004]...[2]........[Desc2]......[true]
  8. [5]....[201401_001_005]...[8]........[Desc2]......[true]
  9. [6]....[201401_001_006]...[2]........[Desc3]......[true]
  10. [7]....[201401_001_007]...[8]........[Desc3]......[true]
  11. [8]....[201401_001_008]...[2]........[Desc4]......[true]
  12. [9]....[201401_001_009]...[8]........[Desc4]......[false]
  13. [10]...[201401_001_010]...[8]........[Desc4]......[true]
  14.  
The test has a series of unknowns that we randomly insert in to the workflow either a control or a control+adulterants (single blind test) and we normally restrict these blind-knows to those we use to calibrate with; however, a random intervals there will be scalar that is not a 2 or an 8 but the property will always be one of the Desc1-4

So the unknowns can have a result ranging from a scalar of 0 thru a scalar of 10 and then a descriptive as to what the diffence is:

Expand|Select|Wrap|Line Numbers
  1. So a typical sample run might be <*> are blind knowns:
  2. tbl_lablogbook
  3. [pk]...[sampleid].....[scalar]...[property]
  4. [1]....[201401_001]...[0]........[Control]<*>
  5. [2]....[201401_002]...[0]........[Control]
  6. [3]....[201401_003]...[1]........[Desc1]
  7. [4]....[201401_004]...[0]........[Control]
  8. [5]....[201401_005]...[8]........[Desc2]<*>
  9. [6]....[201402_001]...[10].......[Desc3]
  10. [7]....[201402_002]...[0]........[Control]<*>
  11. [8]....[201402_003]...[8]........[Desc2]<*>
  12. [9]....[201402_004]...[2]........[Desc(n-2)]
  13. [10]...[201402_005]...[0]........[Control]
  14. [11]...[201402_005]...[5]........[Control]<<INVALID
  15. [12]...[201402_005]...[0]........[Desc(n-2)]<<INVALID
  16.  
Records 1, 5, and 8 would be blind knowns presented as a regular sample
Records 11 and 12 wouldn't be possible you cannot have a 5 scalar difference from the control nor can you have a 0 scalar difference and yet have a description of something different from the control... in the form there would be logic to prevent this.
Jan 13 '14 #5
Rabbit
12,516 Expert Mod 8TB
So if I understand correctly, and I probably got something wrong here.

You have two tables, a scale and a property.

Scale table
Expand|Select|Wrap|Line Numbers
  1. PK Scale1995 Scale2010
  2. 1  0         0
  3. 2  2         1
  4. 3  3         2
  5. .......................
  6. 11 11        10
Property table
Expand|Select|Wrap|Line Numbers
  1. Property
  2. Control
  3. Desc1
  4. Desc2
  5. Desc3
  6. Desc4
And with these two tables, you're trying to derive the table named tbl_callogbook? Or is it tbl_lablogbook you're after?
Jan 13 '14 #6
zmbd
5,501 Expert Mod 4TB
And with these two tables, you're trying to derive the table named tbl_callogbook? Or is it tbl_lablogbook you're after?
ahh...
the two tables play two different roles for the logbook tables and the forms. The "tbl_*logbook" are more historical/audit and I need to populate controls, validate results etc...

For example:
tbl_lablogbook
[lablogbook_pk]autonumber
[lablogbook_sampleid]text(50)
[lablogbook_fk_scalar]numeric(long)
[lablogbook_fk_property]numeric(long)

For the controls on the form, for the lablogbook
This is the general scalar(x)property

Expand|Select|Wrap|Line Numbers
  1. SELECT tbl_scalar.scalar_pk
  2.    , tbl_scalar.scalar_scale2006
  3.    , tbl_property.property_pk
  4.    , tbl_property.property_name
  5. FROM tbl_property, tbl_scalar
  6. WHERE (((tbl_scalar.scalar_pk)=1) 
  7.     AND ((tbl_property.property_name)="Control"))
  8. Union
  9. SELECT tbl_scalar.scalar_pk
  10.    , tbl_scalar.scalar_scale2006
  11.    , tbl_property.property_pk
  12.    , tbl_property.property_name
  13. FROM tbl_property, tbl_scalar
  14. WHERE ((tbl_scalar.scalar_scale2006)>0);
This would be used for two things, validation and "quick select" (instead of two combo boxes, I have one) for the result in tbl_lablogbook...

However when I go to calibrate what I'm using now is something like the following so that if we needed to add levels or properties:

Once again, this is used only for validation and for the "quick selct" on the form.
Expand|Select|Wrap|Line Numbers
  1. SELECT tbl_scalar.scalar_pk
  2.    , tbl_scalar.scalar_scale2006
  3.    , tbl_property.property_pk
  4.    , tbl_property.property_name
  5. FROM tbl_property, tbl_scalar
  6. WHERE (((tbl_scalar.scalar_pk)=1) 
  7.     AND ((tbl_property.property_name)="Control"))
  8. Union
  9. SELECT tbl_scalar.scalar_pk
  10.    , tbl_scalar.scalar_scale2006
  11.    , tbl_property.property_pk
  12.    , tbl_property.property_name
  13. FROM tbl_property, tbl_scalar
  14. WHERE (((tbl_scalar.scalar_scale2006)>0) 
  15.     AND ((tbl_property.property_usethisforspike)=True) 
  16.     AND ((tbl_scalar.scalar_usethisforspike)=True));
So why combine and keep seperate.
So the LabMonkey (that's me (^_^) ) runs the test:
Blind-Control: I need to track, did LabMonkey return Control if not then fail, else pass
Blind-Spike: Did LabMonkey detect difference? Was it the correct property, if no, then fail, if yes then did the LabMonkey return the correct scalar within error (usually +/-1) then pass else fail.

Yes, I'm using an unbound CBO and the afterupdate event to do the quick entries (^_^), the user types 0, or 1 and the first letter of the property, enter, and the entries are made into the table (or LabMonkey can use the table controls and do the double selection thing). The table is bound and the table controls are bound the form while open has the record sets above open at the module level (closed with onclose event) the record/form before update event looks at the current record fields and searches against the above recordset for a match of not found then cancel and warn the user.
Jan 13 '14 #7
Rabbit
12,516 Expert Mod 8TB
So the _usethisforspike fields are chosen by the user whenever they want to run a test?

And the question is whether to continue to use that boolean or whether or not you should use 2 tables to store which values they want to run at the moment. I think both options have their merits.

The 2 table route is, imho, a cleaner design. But it is more resource intensive and ever so slightly more complicated to implement. Whereas the boolean route is not as "elegant" but would run more quickly with large data sets.
Jan 13 '14 #8
Rabbit
12,516 Expert Mod 8TB
A side note on your scale table. It sounds like scale is a slowly changing dimension. In that the values may change over time but you want to preserve the historical values. What we often do with that type of data is to use a start and end date.

tblSlowlyChangingDimension
Expand|Select|Wrap|Line Numbers
  1. PK   EntityID   Desc   StartDate   EndDate
  2. 1    1234       Bob    1/1/1900    6/30/2007
  3. 2    1234       Bobby  7/1/2007    12/31/9999
  4. 3    5678       Jen    1/1/1900    12/31/9999
Jan 13 '14 #9

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

Similar topics

6
by: Tony Johansson | last post by:
Hello Experts! I have the user defined class called Boolean that should be handle all kind of logic expression such as if (a && b && c) or if (!a && b && c) osv I have the class definition...
3
by: Gene Hubert | last post by:
I'm using DataTable.ImportRow to move data from one datatable to another... Dim dt, dtTarget As DataTable Dim dr As DataRow dt = DirectCast(Me.DataSource, DataTable) dtTarget = dt.Clone...
5
by: Marty | last post by:
Is it possible to attach a SQL Server table to Access without using a DSN? Thanks.
10
by: dba123 | last post by:
Why am I getting this error for Budget? Error: An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code Additional information: String was not...
1
by: Chris | last post by:
Hi, I'm using the following code DataTable tables = ((OleDbConnection)oleconn).GetOleDbSchemaTable( OleDbSchemaGuid.Tables, new object { null, null, null, "TABLE" }); foreach (DataRow r in...
1
by: MLH | last post by:
I have a form used as a subform on frmCreateInvoice. It is displayed in datasheet view in the subform control. It displays a few text fields, a boolean field (shown as a checkbox control) and a...
0
by: elainenguyen | last post by:
I am writting an address book which store name and address. I've written a Node class with Get and Set method of String key and String value I've also written a Main class for the menu to promt...
13
JodiPhillips
by: JodiPhillips | last post by:
G'day, I have a silly and simple problem that I need some guidance with. Due to the way our network is set up, I am unable to use the group permissions for Access and have had to implement log...
12
by: Michael.Z | last post by:
Anyone who can help: Given a Table.h file I am writing a Table.c file. I keep getting the compile error: previous declaration of Table was here / conflicting types for I think the...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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
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...
0
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...

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.