I can't think of another way to do this other than:

1-set defaults
2-Check for valueExists
3-getArgument if no valueExists
so:

var rows = 25;

if (event.argumentExists('rows)) {
  rows = event.getArgument('rows');
}

if (event.valueExists('rows')) {
  rows = event.getValue('rows');
}

structInsert(myStruct,'rows',rows);

The problem is that I have at least 3 arguments that can be passed, so this
gets a little long.

Anyone else have a better idea?
On Thu, Oct 22, 2009 at 12:21 AM, David Mineer <[email protected]> wrote:

> You know what, this makes sense now that I think about it a little more.
> The value is set the first time through because that is what I am telling it
> to do.  I say getValue, but if it isn't there, then default it to whatever
> is in the getArgument, and if nothing is there either, then set it 25.
>
> So of course there is a getValue('rows') the second time through.
>
> Hmmm, going to rethink this a little.
>
>   On Thu, Oct 22, 2009 at 12:09 AM, David Mineer <[email protected]> wrote:
>
>> This isn't working.  My shortened code:
>>
>> ModelGlue.xml:
>> <message name="needInfo" >
>>   <argument name="name" value="report1" />
>>   <argument name="rows" value="55" />
>> </message>
>> <message name="needInfo" >
>>   <argument name="name" value="report2" />
>>   <argument name="rows" value="11" />
>> </message>
>>
>> controller:
>> var myStruct = 0;
>> var qry = 0;
>>
>> structInsert(myStruct,'name',event.getArgument('name','report1'));
>> *structInsert*(myStruct,'rows',event.getValue('rows',event.getArgument(
>> 'rows','25')));
>>
>>
>> <CFSET
>> qry =
>> beans.companyGateway.findTopBuildersByDateAndCompanyType(argumentCollection
>> = myStruct) />
>> Both reports return 55 rows.  The first value put into the argument seems
>> to stick.
>>
>> If I change the one line above to:
>>
>> *structInsert*(myStruct,'rows',event.getArgument('rows','25'));
>>
>> It works great. I get 55 rows for report1 and 11 for report2.
>>
>> It almost seems like when I use the getArgument and getValue together, the
>> result is shoved into the event object, therefore on the next iteration, for
>> report2 there is an event.getValue('rows') that already = 55 so it takes the
>> 55 again.  But since I don't do a setValue anywhere for rows in this event I
>> don't know how that could be.
>>   On Wed, Oct 21, 2009 at 8:24 PM, Jared Rypka-Hauer <
>> [email protected]> wrote:
>>
>>> Done it before, in fact... works well. My use case was actually quite a
>>> bit more complicated than that, in fact... and it was MG1.
>>> So yeah, it works.
>>>
>>> J
>>>
>>>   On Oct 21, 2009, at 4:41 PM 10/21/09, Dan Wilson wrote:
>>>
>>>  Seems ok to me..
>>>
>>> DW
>>>
>>>  On Wed, Oct 21, 2009 at 5:38 PM, David Mineer <[email protected]> wrote:
>>>
>>>> event.getValue('rows',event.getArgument('rows',25))
>>>>
>>>
>>> >>>
>>>
>>
>>
>>  --
>> David Mineer Jr
>> ---------------------
>> The critical ingredient is getting off your
>> butt and doing something. It's as simple
>> as that. A lot of people have ideas, but
>> there are few who decide to do
>> something about them now. Not
>> tomorrow. Not next week. But today.
>> The true entrepreneur is a doer.
>>
>
>
>
> --
> David Mineer Jr
> ---------------------
> The critical ingredient is getting off your
> butt and doing something. It's as simple
> as that. A lot of people have ideas, but
> there are few who decide to do
> something about them now. Not
> tomorrow. Not next week. But today.
> The true entrepreneur is a doer.
>



-- 
David Mineer Jr
---------------------
The critical ingredient is getting off your
butt and doing something. It's as simple
as that. A lot of people have ideas, but
there are few who decide to do
something about them now. Not
tomorrow. Not next week. But today.
The true entrepreneur is a doer.

--~--~---------~--~----~------------~-------~--~----~
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" 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/model-glue?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to