You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "Robert G." <ga...@mercon24.de> on 2012/07/30 20:58:25 UTC

Form Field show information from different entities

Hello,

in a form widget I want to show information from *two* entities.

in my screen definition I can call each entity like:
/<entity-condition entity-name="ProductCategoryAttribute"
list="categoryAttributes" >
     <condition-expr field-name="productCategoryId"
from-field="productCategoryId"/>
     <order-by field-name="attrSequenceNum"/>
</entity-condition>

<entity-condition entity-name="ProductCategoryFacet" list="categoryFacets" >
      <condition-expr field-name="productCategoryId"
from-field="productCategoryId"/>                                        
</entity-condition>/

The problem is, that I want in my form to show fields from both entities,
and also want to order both entities by a field from one entity.

So I would have to do sth. like a join (in SQL), but how can I handle it
here without creating a view-entity.

i.ex. fields in entity:

entity 1: pk1 pk2 name1 description1
entity 2: pk1 pk2 name2 description2

now in the form I want to show (as list) selected entries (i.ex. name2) from
entity 2 with sane vakue in pk1.

But also I want to show field value "name1" from the other entity. Cause
they have the same field pl1, I need to get the relation to it, that I can
show it in my form field.

an Idea is to merge both lists, which I get from entity (lists:
categoryAttributes and categoryFacets). But I do not really know how to put
them together, that the relation between the keys is correct.

can someone tell me how to handle it?

Thank you in advance






--
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form Field show information from different entities

Posted by "Robert G." <ga...@mercon24.de>.
Sorry I forgot to point out, that with a click on the filter (or doing a solr
query), only the remaining products (not only the counter). It differs on
your configuration, whcih product information you can get from solr.



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635396.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form Field show information from different entities

Posted by "Robert G." <ga...@mercon24.de>.
exactly that is my option for SEO, but i have not realized yet. 




--
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635889.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form Field show information from different entities

Posted by Deepak Agarwal <da...@gmail.com>.
Only problem with ajax I see is SEO. Normally, I would like all the results
to be cached by search engines. what is your opinion for search engine
optimization here?

On Wed, Aug 22, 2012 at 1:11 PM, Robert G. <ga...@mercon24.de> wrote:

> Hey :)
>
> I did it with JS/Ajax, if you want to send the complete result from server
> side, than I would solrJ (java API for Solr), and send the results to FTL
> or
> groovy--> ftl. Than you can enumerate these results f.ex. with <list>-Tag
> in
> ftl to show them on the page. The solrJ methods are really easy i.ex.:
>
> /
>     //open  the connection to solr
>     CommonsHttpSolrServer solr = new
> CommonsHttpSolrServer("http://localhost:8983/solr");
>
>     //set the query parameter set
>     ModifiableSolrParams params = new ModifiableSolrParams();
>     params.set("q", "cat:electronics");
>     params.set("defType", "edismax");
>     params.set("start", "0");
>
>     //send the query parameter
>     QueryResponse response = solr.query(params);
>
>     //get results
>     SolrDocumentList results = response.getResults();
>
>     //i.ex. print the results
>     for (int i = 0; i < results.size(); ++i) {
>       System.out.println(results.get(i));
>     }/
>
> Kindly
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635879.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
> --
> Thanks,
> Deepak Agarwal,
>
> Paxcel Technologies Pvt Ltd.
> Hartron Complex, Sector 18, Gurgaon, India.
> E-Mail: deepak.agarwal@paxcel.net
> Mobile: +91 9910322604
>
>

Re: Form Field show information from different entities

Posted by "Robert G." <ga...@mercon24.de>.
Hey :)

I did it with JS/Ajax, if you want to send the complete result from server
side, than I would solrJ (java API for Solr), and send the results to FTL or
groovy--> ftl. Than you can enumerate these results f.ex. with <list>-Tag in
ftl to show them on the page. The solrJ methods are really easy i.ex.:

/
    //open  the connection to solr
    CommonsHttpSolrServer solr = new
CommonsHttpSolrServer("http://localhost:8983/solr");

    //set the query parameter set
    ModifiableSolrParams params = new ModifiableSolrParams();    
    params.set("q", "cat:electronics");
    params.set("defType", "edismax");
    params.set("start", "0");
    
    //send the query parameter
    QueryResponse response = solr.query(params);

    //get results
    SolrDocumentList results = response.getResults();

    //i.ex. print the results
    for (int i = 0; i < results.size(); ++i) {
      System.out.println(results.get(i));
    }/

Kindly



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635879.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form Field show information from different entities

Posted by Deepak Agarwal <da...@gmail.com>.
Hello Robert,

I want to use the response of the solr result in ftl . I can see that it is
easily doable with velocity. Any idea how can we do it with ftl (freemarker)


On Tue, Jul 31, 2012 at 2:55 AM, Robert G. <ga...@mercon24.de> wrote:

> Its sth how Solr names a function.
> I just named it CategoryFacet, cause I show it in my category, but it is
> like a product filter.
>
>
> example:
> product 1 productspecification: resolution = XGA and size = 19"
> product 2 productspecification: resolution = WXGA and size = 20"
> product 3 productspecification: resolution = SXGA and size = 24"
> product 4 productspecification: resolution = SXGA and size = 17"
>
> Now in Solr the Facet is: "Resoultion" and the FacetValue is the value
> (XGA,
> WXGA etc.).
>
> Now i can do a filter like:
> *resulotion *
> XGA (1)
> WXGA (1)
> SXGA (2)
>
> *size*
> 17" (1)
> 19" (1)
> 20" (1)
> 24" (1)
> The (...) tells how many products are found.
> when I now i.ex. click on SXGA this changes to:
>
> resolution (just the headline)
> SXGA (2)
> *size*
> 17" (1)
> 24" (1)
>
> With that I can drill down my search results just with easy solr
> querys...hope I explained it well (difficult with just a few sentences)
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635395.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
> --
> Thanks,
> Deepak Agarwal,
>
> Paxcel Technologies Pvt Ltd.
> Hartron Complex, Sector 18, Gurgaon, India.
> E-Mail: deepak.agarwal@paxcel.net
> Mobile: +91 9910322604
>
>

Re: Form Field show information from different entities

Posted by "Robert G." <ga...@mercon24.de>.
Its sth how Solr names a function.
I just named it CategoryFacet, cause I show it in my category, but it is
like a product filter.


example:
product 1 productspecification: resolution = XGA and size = 19"
product 2 productspecification: resolution = WXGA and size = 20"
product 3 productspecification: resolution = SXGA and size = 24"
product 4 productspecification: resolution = SXGA and size = 17"

Now in Solr the Facet is: "Resoultion" and the FacetValue is the value (XGA,
WXGA etc.).

Now i can do a filter like:
*resulotion *
XGA (1)
WXGA (1)
SXGA (2)

*size*
17" (1)
19" (1)
20" (1)
24" (1)
The (...) tells how many products are found.
when I now i.ex. click on SXGA this changes to:

resolution (just the headline)
SXGA (2)
*size*
17" (1)
24" (1)

With that I can drill down my search results just with easy solr
querys...hope I explained it well (difficult with just a few sentences)



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635395.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form Field show information from different entities

Posted by Deepak Agarwal <da...@gmail.com>.
Hey Robert,

Could you please explain what facets are here. Like  categoryFacets . What
is the significance, I mean how should I think them as.

On Tue, Jul 31, 2012 at 2:16 AM, Robert G. <ga...@mercon24.de> wrote:

> mhh, ok a view-entity looks easier as I thougt before :)
>
> thanks, I will try it this way.
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635393.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
> --
> Thanks,
> Deepak Agarwal,
>
> Paxcel Technologies Pvt Ltd.
> Hartron Complex, Sector 18, Gurgaon, India.
> E-Mail: deepak.agarwal@paxcel.net
> Mobile: +91 9910322604
>
>

Re: Form Field show information from different entities

Posted by "Robert G." <ga...@mercon24.de>.
mhh, ok a view-entity looks easier as I thougt before :)

thanks, I will try it this way. 



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635393.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form Field show information from different entities

Posted by "Robert G." <ga...@mercon24.de>.
@Malin Nicolas

thank you, I just tried it, and it works how I wanted to. Thanks


Malin Nicolas wrote
> 
> Do you search to make an entity-view on your tow entites and after make 
> your entity-condition on it ?
> 
> <view-entity entity-name="ProductCategoryAttributeAndFacetView">
>     <member-alias .. ProductCategoryAttribute/>
>     <member-alias .. ProductCategoryFacet/>
>     <alias-all/>
>     &lt;view link ...
>         &lt;key-map field-name=&quot;productCategoryId&quot; /
> 
>   ...
> 
> Nicolas
> Le 30/07/2012 20:58, Robert G. a écrit :
> &gt; Hello,
>>
>> in a form widget I want to show information from *two* entities.
>>
>> in my screen definition I can call each entity like:
>> /<entity-condition entity-name="ProductCategoryAttribute"
>> list="categoryAttributes" >
>>       <condition-expr field-name="productCategoryId"
>> from-field="productCategoryId"/>
>>       <order-by field-name="attrSequenceNum"/>
>> </entity-condition>
>>
>> <entity-condition entity-name="ProductCategoryFacet"
>> list="categoryFacets" >
>>        <condition-expr field-name="productCategoryId"
>> from-field="productCategoryId"/>
>> </entity-condition>/
>>
>> The problem is, that I want in my form to show fields from both entities,
>> and also want to order both entities by a field from one entity.
>>
>> So I would have to do sth. like a join (in SQL), but how can I handle it
>> here without creating a view-entity.
>>
>> i.ex. fields in entity:
>>
>> entity 1: pk1 pk2 name1 description1
>> entity 2: pk1 pk2 name2 description2
>>
>> now in the form I want to show (as list) selected entries (i.ex. name2)
>> from
>> entity 2 with sane vakue in pk1.
>>
>> But also I want to show field value "name1" from the other entity. Cause
>> they have the same field pl1, I need to get the relation to it, that I
>> can
>> show it in my form field.
>>
>> an Idea is to merge both lists, which I get from entity (lists:
>> categoryAttributes and categoryFacets). But I do not really know how to
>> put
>> them together, that the relation between the keys is correct.
>>
>> can someone tell me how to handle it?
>>
>> Thank you in advance
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
> 
> 
> -- 
> Nicolas MALIN
> Consultant
> Tél : 06.17.66.40.06
> Site projet : http://www.neogia.org/
> -------
> Société LibrenBerry
> Tél : 02.48.02.56.12
> Site : http://www.librenberry.net/
> 




--
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391p4635399.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form Field show information from different entities

Posted by Nicolas Malin <ma...@librenberry.net>.
Do you search to make an entity-view on your tow entites and after make 
your entity-condition on it ?

<view-entity entity-name="ProductCategoryAttributeAndFacetView">
    <member-alias .. ProductCategoryAttribute/>
    <member-alias .. ProductCategoryFacet/>
    <alias-all/>
    <view link ...
        <key-map field-name="productCategoryId" /

  ...

Nicolas
Le 30/07/2012 20:58, Robert G. a écrit :
> Hello,
>
> in a form widget I want to show information from *two* entities.
>
> in my screen definition I can call each entity like:
> /<entity-condition entity-name="ProductCategoryAttribute"
> list="categoryAttributes" >
>       <condition-expr field-name="productCategoryId"
> from-field="productCategoryId"/>
>       <order-by field-name="attrSequenceNum"/>
> </entity-condition>
>
> <entity-condition entity-name="ProductCategoryFacet" list="categoryFacets" >
>        <condition-expr field-name="productCategoryId"
> from-field="productCategoryId"/>
> </entity-condition>/
>
> The problem is, that I want in my form to show fields from both entities,
> and also want to order both entities by a field from one entity.
>
> So I would have to do sth. like a join (in SQL), but how can I handle it
> here without creating a view-entity.
>
> i.ex. fields in entity:
>
> entity 1: pk1 pk2 name1 description1
> entity 2: pk1 pk2 name2 description2
>
> now in the form I want to show (as list) selected entries (i.ex. name2) from
> entity 2 with sane vakue in pk1.
>
> But also I want to show field value "name1" from the other entity. Cause
> they have the same field pl1, I need to get the relation to it, that I can
> show it in my form field.
>
> an Idea is to merge both lists, which I get from entity (lists:
> categoryAttributes and categoryFacets). But I do not really know how to put
> them together, that the relation between the keys is correct.
>
> can someone tell me how to handle it?
>
> Thank you in advance
>
>
>
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Form-Field-show-information-from-different-entities-tp4635391.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/