Re: d2w query question
Re: d2w query question
- Subject: Re: d2w query question
- From: Theodore Petrosky <email@hidden>
- Date: Thu, 26 Sep 2013 10:24:27 -0400
On Sep 26, 2013, at 4:41 AM, Fabian Peters <email@hidden> wrote:
> Hi Ted,
>
> Am 26.09.2013 um 01:51 schrieb Theodore Petrosky:
>
>> yea sometimes the original answer to a post was over my head and I didn't understand something, so I gave up.
>>
>> I have your solution working beautifully. I hope this helps me to understand the delegates more.
>>
>> but here is an issue.
>>
>> here is the method that returns the QueryPage:
>>
>> public WOComponent queryBillboardAction() {
>> QueryPageInterface qpi = (QueryPageInterface) D2W.factory().queryPageForEntityNamed("Grid", session());
>>
>> ((D2WComponent) qpi).d2wContext().takeValueForKey("ListBillboard", "navigationState");
>> ((D2WComponent) qpi).d2wContext().takeValueForKey("QueryBillboard", "pageConfiguration");
>>
>> return (WOComponent) qpi;
>>
>> }
>>
>> of course this is a 'subselect' of the entity 'Grid'. so the page that returns is a ListGrid page.
>>
>> How can I control this? It needs to be a ListBillboard page.
>
> If your query page should return a list of billboards, then I guess the query page should be one for billboards. If a billboard has some relation to grid, you can still query for grid attributes by specifying key-paths from billboard. Something like "billboard.grids.id".
it's the other way around. I have an entity 'Grid'. this entity has a boolean attribute isBillboard. I have created a tab that gives a listing of a subset of Grid where isBillboard is true.
In the action method that returns the ListGrid page, I set the navigationState:
>>>>> ((D2WComponent) lpi).d2wContext().takeValueForKey("ListBillboard", "navigationState");
I have a search button that I set the delegate to return Grid entities where isBillboard is true.
Unfortunately, when you do a query, the returning page is a 'ListGrid' page (As the entity is Grid). I am looking for a way such that when this ListGrid page is returned, I can set the navigationState to 'ListBillboard'.
I could make this easy on myself and create a view on the backend called Billboard. (CREATE VIEW billboard AS SELECT * FROM t_grid WHERE isbillboard = true). I could even set up some rules and triggers on the backend that would make it updatable. Then I could just treat it as a separate entity and be done.
But I thought I would just stay on the WO side of things.
>
> Fabian
>
>> Thank you for your patience. When I first read your solution over a year ago I felt it was too complex as I didn't have the knowledge to understand it. Funny what another year looking at this stuff can do.
>>
>> Ted
>>
>>
>> On Sep 25, 2013, at 4:26 PM, David Holt <email@hidden> wrote:
>>
>>> Nothing like a little deja vu, including the original poster.
>>>
>>> :-)
>>>
>>>
>>> On 2013-09-25, at 12:40 PM, Johnny Miller <email@hidden> wrote:
>>>
>>>> Like this?
>>>>
>>>> http://lists.apple.com/archives/webobjects-dev/2012/Apr/msg00260.html
>>>>
>>>>
>>>> On Sep 25, 2013, at 9:23 AM, Theodore Petrosky <email@hidden> wrote:
>>>>
>>>>> I have an entity 'Grid' that has an attribute 'isBillboard'. I created the list billboard tab with:
>>>>>
>>>>> public WOComponent listBillboardAction() {
>>>>>
>>>>> EOEditingContext ec = ERXEC.newEditingContext();
>>>>> ListPageInterface lpi = (ListPageInterface) D2W.factory().pageForConfigurationNamed("ListGrid", session());
>>>>>
>>>>> EODatabaseDataSource ds = new EODatabaseDataSource(ec, "Grid");
>>>>>
>>>>> ERXFetchSpecification<Grid> fs = new ERXFetchSpecification<Grid>(Grid.ENTITY_NAME, Grid.IS_COMPLETE.eq(false).and(Grid.IS_BILLBOARD.eq(true)), null);
>>>>>
>>>>> ds.setFetchSpecification(fs);
>>>>>
>>>>> lpi.setDataSource(ds);
>>>>>
>>>>> ((D2WComponent) lpi).d2wContext().takeValueForKey("ListBillboard", "navigationState");
>>>>>
>>>>> return (D2WPage) lpi;
>>>>> }
>>>>>
>>>>>
>>>>> How can I apply the same limit to a Query page? I don't want to put a control on the page to select 'isBillboard', i want isBillboard to be true
>>>>>
>>>>>
>>>>> public WOComponent queryBillboardAction() {
>>>>> QueryPageInterface qpi = (QueryPageInterface) D2W.factory().queryPageForEntityNamed("Grid", session());
>>>>>
>>>>> ((D2WComponent) qpi).d2wContext().takeValueForKey("ListBillboard", "navigationState");
>>>>>
>>>>> return (WOComponent) qpi;
>>>>>
>>>>> }
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list (email@hidden)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden