that would be great if i could actually evaluate it as empty or null. my
if(loginRequired GT "") evaluation is an attempt at not including
loginRequired in the map. if i can only conditionally evaluate a boolean as
true or false and not "" (empty) or NULL, i do not have the ability to
dynamically exclude it from the map because it will always evaluate as
'false' (defaulted from transfer within my handler, then evaluated in my
conditional within my manager) even if it is left "empty" by me when i first
create the transfer object from my event handler.

my issue is that i actually *do* want to filter by it, *and* i want to
filter 'true', 'false', as well as "true and false".

again... i'm taking in arguments from the request scope into the event scope
(via coldbox), and turning those into a transfer object. when that transfer
object is created, empty properties are either left empty (strings) or else
default properties are applied (numeric, uuid, and boolean). the fact that
numeric and uuid apply default values has (up to now) not been an issue
because i can actually evaluate them conditionally and the likelyhood that
the defaults would show up in my data is neglligible. however, i can see how
this would also be a problem if i actually *did* want to filter on '0' for a
numeric property.

-- 
Jim Rising
Serial Entrepreneur
Software Engineer
Web Developer

"Knowledge work requires both autonomy and accountability."

On Wed, Aug 26, 2009 at 6:27 PM, Mark Mandel <[email protected]> wrote:

> But I can see that you are including it in your:
> map.loginRequired
>
> If you don't want to filter by it, then don't include it in the
> listByPropertyMap()
>
> Mark
>
>
> On Thu, Aug 27, 2009 at 7:35 AM, Jim Rising <[email protected]>wrote:
>
>>
>> no. i want both true and false (all records independent of the boolean
>> field).
>>
>> preferably, when i am not populating setLoginRequired() myself... i
>> would rather it not include it in the where clause.
>>
>> -jim
>>
>>
>> On Aug 26, 3:35 pm, Mark Mandel <[email protected]> wrote:
>> > I'm so confused still... so you want a list of all records that are
>> false...
>> > but not the ones that are false? Huh?
>> >
>> > Mark
>> >
>> >
>> >
>> > On Thu, Aug 27, 2009 at 1:08 AM, Jim Rising <[email protected]>
>> wrote:
>> > > The only workaround that i've found for this is to set all of my
>> boolean
>> > > fields to varchar. if i do this and the request does not contain
>> > > loginRequired, it does not seem to be included in transfer's where
>> clause,
>> > > thereby returning all of the true and all of the false records.
>> >
>> > > --
>> > > Jim Rising
>> > > Serial Entrepreneur
>> > > Software Engineer
>> > > Web Developer
>> >
>> > > "Knowledge work requires both autonomy and accountability."
>> >
>> > > On Wed, Aug 26, 2009 at 10:02 AM, Jim Rising <[email protected]
>> >wrote:
>> >
>> > >> it seems that even if i do not pass my loginRequired in as part of
>> the
>> > >> request, it still finds it's way into transfer's where clause with
>> the
>> > >> default of 'false':
>> >
>> > >> 'select name, description, loginRequired, apiEventID from apievents
>> where
>> > >> loginRequired = false'
>> >
>> > >> the problem seems to be that because
>> arguments.apiEvent.getLoginRequired()
>> > >> is already set as 'false', loginRequired always evaluates as GT "",
>> and gets
>> > >> passed into my map. If I change it to anything else via configure()
>> other
>> > >> than true or false, it is no longer boolean and throws a type error
>> (makes
>> > >> sense). i have handled this with other data types by checking for the
>> > >> default value, but the nature of bit values seems to create a paradox
>> where
>> > >> i can't just obtain a list of true and false records. :)
>> >
>> > >> ultimately what i'm wanting is that if there is nothing passed into
>> the
>> > >> request scope for 'loginRequired', i don't want it included in the
>> map for
>> > >> listByPropertyMap.
>> >
>> > >> Here is the relavent portion of my manager:
>> >
>> > >>     <cffunction name="getByAttributesRelated" access="public"
>> > >> returntype="any">
>> > >>         <cfargument name="apiEvent"
>> type="transfer.com.transferObject"
>> > >> required="true">
>> > >>         <cfargument name="sortBy" type="string" required="false"
>> > >> default="userID">
>> > >>         <cfargument name="orderAsc" type="string" required="false"
>> > >> default="true">
>> >
>> > >>         <cfset var apiEventID = arguments.apiEvent.getApiEventID()>
>> > >>         <cfset var name = arguments.apiEvent.getName()>
>> > >>         <cfset var description = arguments.apiEvent.getDescription()>
>> > >>         <cfset var loginRequired =
>> arguments.apiEvent.getLoginRequired()>
>> >
>> > >>         <cfscript>
>> > >>         map = StructNew();
>> > >>         if(apiEventID GT "" and apiEventID NEQ 0)
>> > >>         {
>> > >>             map.apiEventID = apiEventID;
>> > >>         }
>> > >>         if(name GT "")
>> > >>         {
>> > >>             map.name = name;
>> > >>         }
>> > >>         if(description GT "")
>> > >>         {
>> > >>             map.description = description;
>> > >>         }
>> > >>         if(loginRequired GT "")
>> > >>         {
>> > >>             map.loginRequired = loginRequired;
>> > >>         }
>> >
>> > >>         // get a query of the users that match this map
>> > >>         apiEvents = transfer.listByPropertyMap("apiEvent.ApiEvent",
>> map,
>> > >> "#arguments.sortBy#", #arguments.orderASC#);
>> >
>> > >> Thanks for the help!
>> >
>> > >> --
>> > >> Jim Rising
>> > >> Serial Entrepreneur
>> > >> Software Engineer
>> > >> Web Developer
>> >
>> > >> "Knowledge work requires both autonomy and accountability."
>> >
>> > >> On Tue, Aug 25, 2009 at 4:27 PM, Mark Mandel <[email protected]
>> >wrote:
>> >
>> > >>> Jim, I'm trying to follow you here...
>> >
>> > >>> On Wed, Aug 26, 2009 at 6:41 AM, Jim Rising <
>> [email protected]>wrote:
>> >
>> > >>>> just curious if anyone has ever run into any issues with transfer
>> > >>>> creating default values for boolean?
>> >
>> > >>> Transfer default boolean values to false, yes. You can override this
>> in a
>> > >>> configure() method.
>> >
>> > >>>> what i'm doing, is building a transfer object out of an event into
>> a
>> > >>>> coldbox handler called 'apiEvent.getByAttributes', and then passing
>> these
>> > >>>> into a manager i've built called 'apiEvent.getByAttributes'... one
>> of the
>> > >>>> properties is 'loginRequired', which in mySQL is a tinyInt, and in
>> my
>> > >>>> transfer config is a boolean. when i instatiate the apiEvent
>> transfer object
>> > >>>> out of the event scope data (request), and there is no
>> > >>>> event.getValue("loginRequired"), the getLoginRequired() from
>> transfer
>> > >>>> defaults to 'false'.
>> >
>> > >>> Is this a problem? What would you like it to default to (in your
>> > >>> application context)?
>> >
>> > >>>> the problem that i am trying to resolve is simply that i would like
>> to
>> > >>>> retrieve via listByPropertyMap (in the manager) a list of ALL of my
>> > >>>> apiEvents (irrespective of loginRequired) but also still be able to
>> retrieve
>> > >>>> apiEvents with loginRequired explicitly declared true or false. it
>> seems
>> > >>>> that i can only retrieve true or false, but not both because
>> transfer
>> > >>>> defaults to false. i get why it's doing it, and i've worked around
>> it with
>> > >>>> other field types... but have not figured out a way to deal with
>> boolean.
>> >
>> > >>> This is where you lose me. Maybe if you provide an example of what
>> you
>> > >>> are trying to do?
>> >
>> > >>> Mark
>> >
>> > >>> --
>> > >>> E: [email protected]
>> > >>> T:http://www.twitter.com/neurotic
>> > >>> W:www.compoundtheory.com
>> >
>> > --
>> > E: [email protected]
>> > T:http://www.twitter.com/neurotic
>> > W:www.compoundtheory.com
>>
>>
>
>
> --
> E: [email protected]
> T: http://www.twitter.com/neurotic
> W: www.compoundtheory.com
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to