Annotation of Examples/EnterpriseObjects/QueryByExample/README.rtfd/TXT.rtf, revision 1.1

1.1     ! root        1: {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
        !             2: \paperw10800
        !             3: \paperh10600
        !             4: \margl60
        !             5: \margr100
        !             6: {\colortbl;\red0\green0\blue0;}
        !             7: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs36\fc0\cf0 QueryByExample
        !             8: \b0\fs24 \
        !             9: by Craig Federighi, EO Development Team\
        !            10: and Mai Nguyen, NeXT Developer Support\
        !            11: \
        !            12: 
        !            13: \b\fs28 Overview
        !            14: \b0\fs24 \
        !            15: \
        !            16: QBE works by temporarily taking over the UI managed by an EOController and\
        !            17: allowing the user to specify a query by filling out some subset of the UI\
        !            18: elements.  Then QBE contructs an EOQualifier to match those entries, applies\
        !            19:  it the the controller's EODatabaseDataSource, and returns the UI to normal\
        !            20: operation.\
        !            21: \
        !            22: 
        !            23: \b\fs28 The Example Folder\
        !            24: 
        !            25: \b0\fs24 \
        !            26: The QueryByExample is composed of the following:\
        !            27: \
        !            28: 
        !            29: \pard\tx1440\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fi-1440\li1440\fc0\cf0 1) A 
        !            30: \b QBE
        !            31: \b0  object to do the query by example (Files QBE.[hm])\
        !            32: 2) A 
        !            33: \b SortOrderSetter
        !            34: \b0  object to do sorting on any entity of an eomodel\
        !            35: 
        !            36: \pard\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 (Files SortOrderSetter.[hm])\
        !            37: 3) A 
        !            38: \b Dictionary
        !            39: \b0  data source object  based on the foundation class NSMutableDictionary (Files DictionaryDataSource.[hm])\
        !            40: 
        !            41: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
        !            42: Note that you can also use the 3 functionalities listed above separately.\
        !            43: \
        !            44: The 
        !            45: \b QBEPalette
        !            46: \b0   builds an IB palette for the QBE and SortOrderSetter objects.\
        !            47: \
        !            48: 
        !            49: \b\fs28\fc1\cf1 How QBE works
        !            50: \b0\fs24\fc0\cf0 \
        !            51: \
        !            52: 
        !            53: \b\fs26\fc1\cf1 Taking over the UI\
        !            54: 
        !            55: \b0\fs24\fc0\cf0 \
        !            56: The QBE object allows you to toggle between QBE mode and simple display mode.\
        !            57: When running in QBE mode, the QBE object will control the User Interface's behavior.\
        !            58: This control involves several steps:\
        !            59: \
        !            60: 
        !            61: \b � Replacing the Data Source:\
        !            62: 
        !            63: \b0 The controller's EODatabaseDataSource is temporarily replaced with a\
        !            64: DictionaryDataSource used to collect the query specification.\
        !            65:  \
        !            66: 
        !            67: \b � Disabling linked controllers:
        !            68: \b0 \
        !            69: During query entry, linked controllers (i.e. Detail controllers and the\
        !            70: nextController chain) are unlinked so they will not update incorrectly. Note that otherwise the update methods are being forwarded to detail controllers and next controllers.\
        !            71:  \
        !            72: 
        !            73: \b � Reconfiguring control editability:
        !            74: \b0 \
        !            75: All UI objects associated with keys that can be queried in the data source are temporarily\
        !            76: made editable to accomodate query entry.\
        !            77: \
        !            78: \
        !            79: 
        !            80: \b Query Construction
        !            81: \b0 \
        !            82:  \
        !            83: Query contruction is accomplished by constructing a qualifier to match each\
        !            84: attribute specified by the user and then conjoining or disjoining them to\
        !            85: produce a composite fetch qualifier.  Range queries are supported by parsing\
        !            86: for comparison operators in the prefix of value string and using them in the query\
        !            87: construction.\
        !            88: \
        !            89: There are 3 types of action methods that you can connect from a Button to the QBE object:\
        !            90: \
        !            91: 
        !            92: \b � enterQueryMode:
        !            93: \b0 \
        !            94: This method will put 
        !            95: \fc1\cf1 the user interface into
        !            96: \fc0\cf0  QBE mode, i.e., now all associations to the EOController will be made editable t
        !            97: \fc1\cf1 o allow query entry
        !            98: \fc0\cf0 .  
        !            99: \fc1\cf1 If the controller is already in QBE mode when this message is sent, another row is added to the dictionary data source to allow entry of another qualifier.  QBE will "OR" all such qualifiers together when constructing the fetch qualifier.\
        !           100: \
        !           101: 
        !           102: \b\fc0\cf0 � applyQualifier: \
        !           103: 
        !           104: \b0 Builds a 
        !           105: \fc1\cf1 qualifier
        !           106: \fc0\cf0  ANDING all the current attribute settings
        !           107: \fc1\cf1 , and applies it to the dataSource. 
        !           108: \fc0\cf0 After the qualifier is built, this method will exit query mode, 
        !           109: \fc1\cf1 restoring
        !           110: \fc0\cf0  the old data source and controller settings. It then performs a fetch on the controller to display the results from the query.\
        !           111: \
        !           112: 
        !           113: \b � toggleQueryFetch:
        !           114: \b0 \
        !           115: This method offers a convenient way for a single user interface button to support entering and exiting QBE mode.  The first time it is called it issues 
        !           116: \b enterQueryMode:
        !           117: \b0 , the next time 
        !           118: \b applyQualifier:
        !           119: \b0 , and so on.\
        !           120: \
        !           121:  \
        !           122: 
        !           123: \b Possible Enhancements
        !           124: \b0 \
        !           125: When QBE puts a controller in query mode, 
        !           126: \fc1\cf1 it should
        !           127: \b\i\fc0\cf0  
        !           128: \b0\i0 do the same for all linked\
        !           129: controllers that have DatabaseDataSources (and disable the others).\
        !           130: \
        !           131: 
        !           132: \fc1\cf1 \
        !           133: 
        !           134: \b\fs28 SortOrderSetter\
        !           135: 
        !           136: \b0\fs24 \
        !           137: SortOrderSetter allows the user to easily apply a sort ordering to EOController by selecting columns in an NXTableView.  When a 
        !           138: \b sortAscending:
        !           139: \b0  or 
        !           140: \b sortDescending:
        !           141: \b0  message is sent to the SortOrderSetter object, it determines the currently active TableView and notes the keys corresponding to its selected columns.  These keys are then used to construct an EOAttributeOrdering array which is applied to the EODatabaseDataSource for the TableView's EOController.\
        !           142:   \
        !           143: 
        !           144: \b  
        !           145: \b0 \
        !           146: 
        !           147: \b\fs28 DictionaryDataSource\
        !           148: 
        !           149: \b0\fs24 \
        !           150: The DictionaryDataSource is an example of a non-database object that conforms to the EODataSources protocol, and is implemented as an array of dictionary objects.  The QBE object uses the DictionaryDataSource to accumulate the user's query specification when in query mode.\
        !           151:  \
        !           152:  
        !           153: \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\b\fs28\fc1\cf1 \
        !           154: How to build a QBE Demo
        !           155: \b0\fs24 \
        !           156: \
        !           157: 
        !           158: \b\fs28 To use the SortOrderSetter palette
        !           159: \b0\fs24 \
        !           160: Load the QBEPalette.palette into IB.\
        !           161: \
        !           162: Drag the SortOrderSetter palette 
        !           163: {{\NeXTGraphic4249 SortOrderSetter.tiff \width960 \height960
        !           164: }
        !           165: �}\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ulnone\fs24\fc1\cf1 \
        !           166: \
        !           167: into your IB file window.  If you already set up a NXTableView with associations to an EOController with a EODatabaseDataSource, you will only need to connect a button to one of the 2 target/action methods, 
        !           168: \b setOrderAscending:
        !           169: \b0  or 
        !           170: \b setOrderDescending:
        !           171: \b0 . Now, you can fetch and reorder the tableview data by selecting table view columns and pressing that button.\
        !           172: \
        !           173: \
        !           174: 
        !           175: \b\fs28 To use the QBE palette\
        !           176: 
        !           177: \b0\fs24 Load the QBEPalette.palette into IB.\
        !           178: Drag the QBE palette 
        !           179: {{\NeXTGraphic4693 QBE.tiff \width960 \height960
        !           180: }
        !           181: �}\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ulnone\fs24\fc1\cf1 \
        !           182: into your IB file window. Drag an eomodel file into IB. This model file will turn into an EOController. Connect the QBE controller outlet to this EOController (This step is 
        !           183: \i important!).
        !           184: \i0 \
        !           185: Drag a NXTableView into your Application window.  Make the desired associations from the controller to the tableview. Connect a button to the QBE object  to the 
        !           186: \b toggleQueryFetch:
        !           187: \b0  target/action method (See the description of QBE above on how to use the other methods). You are now ready to run.  After performing fetch, press the QBE button (
        !           188: \b toggleQueryFetch:
        !           189: \b0 ) to enter QBE mode and enter a query string into a cell of the table view (for example > 5000 for the EMPLOYEE SALARY attribute).  Now push the QBE button again to apply the qualifier.  To clear the qualifier (fetch all records),  exit the query mode with a blank query specification.\
        !           190: \
        !           191: \
        !           192: 
        !           193: \b\fs28 Building a Project that uses QBE
        !           194: \b0\fs24 \
        !           195: \
        !           196: To link a project that uses QBE, you will either need to add the [.hm] files that correspond to the QBE and DictionaryDataSource objects to your project, or change your Makefile.preamble to link in the libQBE.a library.\
        !           197: \
        !           198: 
        !           199: \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b\fs28\fc0\cf0 Known Limitations\
        !           200: 
        !           201: \b0\fs24 \
        !           202: The current QBE object only supports queries for strings, numbers, and dates. It may have to be extended to handle other data types.\
        !           203: 
        !           204: \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 \
        !           205: 
        !           206: \b\fs28 Other Peculiarities\
        !           207: 
        !           208: \fs24  
        !           209: \b0 \
        !           210: QBEPalette produces a 
        !           211: \b libQBE.a
        !           212: \b0  located under ./Lib that you can re-use in your other projects. You will need to include both 
        !           213: \b libQBE.a
        !           214: \b0  and the Headers in ./Headers to compile successfully.\
        !           215: \
        !           216: \
        !           217: Valid for NEXTSTEP Release 3.2 installed with the Enterprise Objects Framework Release 1.0\
        !           218: \
        !           219: 
        !           220: \b\fs28 Change History
        !           221: \b0\fs24 \
        !           222: \
        !           223: 16/February/95 Last edited for EOF Release 1.1 (mai nguyen)
        !           224: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.