The fastest easiest way to get it right.

The DOMINANT Automation

The DOMINANT automation is usually applied to cbool columns, and it allows only one row in a set to have a value of "Y". If one row gets a value of "Y", any other row that might have it already is set to "N".

Consider the following list:

Song Best Ever
Sultans of Swing N
The Desert is On Fire Y
Neireka N
Roddy McCorley N
Lucifer Sam N

Now along comes somebody who disagrees with this choice of the "best ever" song and wants to set "Lucifer Sam" as the best ever. In the Andromeda philosophy, the application should only have to issue a single update, and not go hunting around for any other rows to reset. We want this command:

UPDATE SONGS SET bestever='Y' Where songname='Lucifer Sam'

To result in this:

Song Best Ever
Sultans of Swing N
The Desert is On Fire N
Neireka N
Roddy McCorley N
Lucifer Sam Y

If the "Best Ever" column has "automation_id: dominant", then only one row can have a value of "Y", and when one row is set to "Y" to current row is reset to "N".

Restricting By Foreign Key

In most situations the DOMINANT flag should not apply to an entire table. Switching examples, consider a list of parts, and a list of vendors that supply the various parts. At any given time, only one vendor per part is the preferred or primary vendor. To do this we set the "automation_id" to the name of the parent table.

table partsxvendors:
    module: inventory
    description: Vendor Item XRef
    
    
    foreign_key items:
    foreign_key vendors:
    
    columnn flag_dominant:
        suffix: _dominant
        auto:dominant,items
        
    # Or, in expanded syntax:
    column flag_dominant:
        suffix: _dominant
        automation_id: dominant
        auto_formula: items

User Comments

There are no user comments yet on this page.


Add A Comment

Comments will not appear until after they are moderated. Comments are usually moderated within a few hours on weekdays, but may take longer on weekends and holidays.

Name or nickname: (This will appear with your comment)


Email (this will never be displayed)


Enter your comment here. Use [b] and [/b] for bold, [i] and [/i] for italic, and [pre] and [/pre] for code samples. All literal HTML and PHP that you enter will be escaped out and displayed as you enter it.


Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2010, Licensed under the GPL Version 2