Blogs

Posted At : 08 August 2008 18:50 | Posted By : Alex Lloyd
Related Categories: Development

Hello all, long time no... blog post(ing)(?)

Anywho, today i put together a new transfer lexicon for the listByPropertyMap function within transfer,

it look like dis:

<cfscript>
if (fb_.verbInfo.executionMode is "start") {
            if (not structKeyExists(fb_.verbInfo.attributes,"object")) {
               fb_throw("fusebox.badGrammar.requiredAttributeMissing",
                        "Required attribute is missing",
                        "The attribute 'object' is required, for a 'listByPropertyMap' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
            }
            if (not structKeyExists(fb_.verbInfo.attributes,"query")) {
               fb_throw("fusebox.badGrammar.requiredAttributeMissing",
                        "Required attribute is missing",
                        "The attribute 'query' is required, for a 'listByPropertyMap' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
            }
            if (NOT structKeyExists(fb_.verbInfo.attributes,"orderProperty")) {
               fb_.verbInfo.attributes.orderProperty = '';
            }
            if (not structKeyExists(fb_.verbInfo.attributes,"propertyMap")) {
               fb_throw("fusebox.badGrammar.requiredAttributeMissing",
                        "Required attribute is missing",
                        "The attribute 'propertyMap' is required, for a 'listByPropertyMap' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
            }

            fb_appendLine('<cfset #fb_.verbInfo.attributes.query# = ' &
                  'myFusebox.getApplication().getApplicationData(). cont>

transferFactory.getTransfer().listByPropertyMap("#fb_.verbInfo.attributes.object#", "#fb_.verbInfo.attributes.propertyMap#", "#fb_.verbInfo.attributes.orderProperty#") />');
            fb_appendLine('<cfset myFusebox.trace("Transfer","Listed Records") />');
         } else {
}
</cfscript>

This allows use of the lisByPropertyObject, which allows queries with where clauses. You can call it with fusebox code lookin' like dis:

<tr:listByPropertyMap object="package.objectName" query="queryName" propertyMap="#whereStruct#" orderProperty="OrderBy" />

The WhereStruct is a struct of your where statements for example:

<set name="whereStruct" value="#structNew()#" />
<set name="whereStruct.column1" value="SomeKindaValue" />
<set name="whereStruct.column2" value="SomeOtherValue" />

This needs some tidying up, and i'll get it to accept parameter inputs instead of the ugly whereStruct, but this is the Q&D version.




As ever, if you have any questions, comment below, and i'll try and get back to you!

Lloyd

Comments

© 1998 - 2008 TalkWebSolutions Ltd. Registered in England No. 04521175.