RE: Filtering AssetListScreenlet

László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Hi!
I tried to filter AssetListScreenlet, I can filter by category, tags, but is it possible to filter by articleId?
In https://github.com/liferay/liferay-portal/blob/master/portal-kernel/src/com/liferay/asset/kernel/service/persistence/AssetEntryQuery.java I didn't find parameter for this.
How can I resolve this?Thank you!
thumbnail
Mohammed yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi,
You can use keyword for filtering with article id  
László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Thank you! Can you send me an example? for multiple articleIds
thumbnail
Mohammed yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
I dont think you can search multiple article ids in single keyword but directly articleid you can search using keyword
László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
This is the problem... I must ... In keywords I can't use articleId.
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Normally when you know the article you want to display, you configure the portlet (or screenlet in your case) to use a Manual Query where you are able to then "pick the item" rather than using a Dynamic query. To my knowledge, you can't add "ids" to the asset entry query when you configure it -- I guess because you aren't supposed to know what they are? emoticonDo you need more than one article? or are you looking to just configure a single item?
László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Hi! I want to filter asset list by articles, or by some data in articles like date, for example which article's date data in the given interval.
Another behaviour is We made a service for User's favorites. User's checking some article into his favorite store (we store articleIds). These articles have different  structureId and different Activity to show. I'd like to show him his mixes favorites in another function that hasn't any filter and I want to forward to the specified Activity. So I want to filter assetListScreenlet by articleIds. Can I resolve this, or I must create my own implementation?
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
I think the bad news is, that sounds too custom to use the generic out of the box. I think you are going to have to build your own screenlet for that one. The out of the box AssetPublisher (and corresponding Screenlet) are really just used for basic listing and filtering.
You should still be able to leverage the Liferay API to do most of the heavy lifting for you -- but I don't think, if I understand your requirements, the AssetEntryQuery will work for all of your use cases. Sounds to me like you are going to have to leverage the Journal API, and for some of your more complicated scenarios, I think you might be stuck using a Dynamic Query (as I think someone else on the thread may have suggested)
If you need help figuring out how to use other parts of the API though, don't hesitate to ask.
László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Thank you, I think we must create our service. :-(
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Yeah, I know, it can be a bummer sometimes. But, try to think of all the great stuff that you DON'T have to do that Liferay is doing for you out of the box. You're probably still way ahead of the game. If nothing else, at least you know that the Liferay community is here to help when you need it.