I have added some print statements to the code to see what is generated, and I see following in my ofbiz console:
selectedExperiences are 10003, 10020 condList = [profileOwnerId = '10010', experienceId IN ('1', '0', '0', '0', '3', ',', ' ', '1', '0', '0', '2', '0')] cond = (profileOwnerId = '10010' AND experienceId IN ('1', '0', '0', '0', '3', ' ,', ' ', '1', '0', '0', '2', '0')) It seems that the values of the second part of the query_string (&experienceSelected=10003, 10020) parsed in individual characters in EntityCondition.makeCondition("experienceId", EntityOperator.IN, selectedExperiences as List) 2010/8/23 Pierre Smits <pierre.sm...@gmail.com> > You are absolutely right. Slightly the same is a huge difference... > > > Regards, > > Pierre > > 2010/8/23 Scott Gray <scott.g...@hotwaxmedia.com> > >> The same or slightly different? You also need to do the same for the >> EntityOperator class and any others that are being used by your script. >> >> Regards >> Scott >> >> On 23/08/2010, at 8:47 PM, Pierre Smits wrote: >> >> > Hi Scott, >> > >> > I added the import. Unfortunately, the result is the same error. >> > >> > Regards, >> > >> > Pierre >> > >> > >> > 2010/8/23 Scott Gray <scott.g...@hotwaxmedia.com> >> > Hi Pierre, >> > >> > You need to add the EntityCondition class to the list of imports: >> > import org.ofbiz.entity.condition.EntityCondition; >> > >> > Regards >> > Scott >> > >> > HotWax Media >> > http://www.hotwaxmedia.com >> > >> > On 23/08/2010, at 7:49 PM, Pierre Smits wrote: >> > >> > > The error more readable: >> > > >> > > Problems with the response writer/output stream: >> > > org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen >> > > >> [component://profiler/widget/ProfilerPrintScreens.xml#PrintProfilePDF]: >> > > groovy.lang.MissingPropertyException: No such property: >> EntityCondition for >> > > class: ProfileExperiences (No such property: EntityCondition for >> class: >> > > ProfileExperiences) >> > > >> > > Regards, >> > > >> > > Pierre >> > > >> > > 2010/8/23 Pierre Smits <pierre.sm...@gmail.com> >> > > >> > >> Hi Scott, >> > >> >> > >> Thanks for the pointer. I think it should be on the money.... However >> after >> > >> some tweaking I got following error: >> > >> >> > >> <p>Problems with the response writer/output stream: >> > >> >> > >> org.ofbiz.widget.screen.ScreenRenderException: >> > >> Error rendering screen >> [component://profiler/widget/ProfilerPrintScreens.xml#PrintProfilePDF]: >> > >> >> > >> groovy.lang.MissingPropertyException: No such property: >> > >> EntityCondition for class: ProfileExperiences (No such >> property: EntityCondition for class: ProfileExperiences) >> > >> >> > >> </p> >> > >> >> > >> >> > >> The complete code in the groovy file is: >> > >> import org.ofbiz.base.util.*; >> > >> import org.ofbiz.entity.*; >> > >> import org.ofbiz.entity.util.*; >> > >> import org.ofbiz.party.contact.*; >> > >> import javolution.util.FastMap; >> > >> >> > >> List experienceItems = []; >> > >> >> > >> profileOwnerId = profileSummary.profileOwnerId; >> > >> selectedExperiences = parameters.experienceSelected; >> > >> >> > >> >> > >> condList = []; >> > >> condList.add(EntityCondition.makeCondition("profileOwnerId", >> > >> profileOwnerId)); >> > >> if (selectedExperiences) { >> > >> condList.add(EntityCondition.makeCondition("experienceId", >> > >> EntityOperator.IN, selectedExperiences as List)); >> > >> } >> > >> cond = EntityCondition.makeCondition(condList); >> > >> experienceItemList = delegator.findList("ProfileExperience", cond, >> null, >> > >> null, null, false); >> > >> >> > >> if (experienceItemList) { >> > >> experienceItemList.each { profileExperience -> >> > >> experienceDesc = profileExperience.experienceDesc; >> > >> experienceStartDate = profileExperience.experienceStartDate; >> > >> experienceEndDate = profileExperience.experienceEndDate; >> > >> experienceCustomerId = profileExperience.experienceCustomerId; >> > >> experienceIndustryId = profileExperience.experienceIndustryId; >> > >> experienceProjectId = profileExperience.experienceProjectId; >> > >> experienceTaskId = profileExperience.experienceTaskId; >> > >> experienceBackground = profileExperience.experienceBackground; >> > >> experienceContext = profileExperience.experienceContext; >> > >> experienceTask = profileExperience.experienceTask; >> > >> experienceMethods = profileExperience.experienceMethods; >> > >> experienceTools = profileExperience.experienceTools; >> > >> >> > >> Map experienceItemMap = FastMap.newInstance(); >> > >> experienceItemMap.putAll((Map) profileExperience); >> > >> >> > >> experienceItems.add(experienceItemMap); >> > >> } >> > >> context.experienceItems = experienceItems; >> > >> } >> > >> >> > >> Any suggestions? >> > >> >> > >> Regards, >> > >> >> > >> Pierre >> > >> >> > >> >> > >> 2010/8/21 Scott Gray <scott.g...@hotwaxmedia.com> >> > >> >> > >> Hi Pierre, >> > >>> >> > >>> See my other response to Michal for the correct code, it was only >> from >> > >>> memory though so may not actually work without tweaking. >> > >>> >> > >>> Regards >> > >>> Scott >> > >>> >> > >>> On 21/08/2010, at 12:02 AM, Pierre Smits wrote: >> > >>> >> > >>>> Hi Scott, >> > >>>> >> > >>>> Thanks for the pointer! >> > >>>> >> > >>>> Unfortunately, I am a total groovy-newbie.... >> > >>>> >> > >>>> Would >> > >>>> selectedExperiences = parameter.selectedExperiences; >> > >>>> if (selectedExperiences==""){ >> > >>>> experienceItemList = delegator.findByAnd("ProfileExperience", >> > >>>> [profileOwnerId : profileOwnerId]); >> > >>>> } >> > >>>> else{ >> > >>>> experienceItemList = delegator.findList("ProfileExperience", >> > >>>> [experienceId : selectedExperiences]); >> > >>>> >> > >>>> } >> > >>>> >> > >>>> do the trick? >> > >>>> >> > >>>> Regards, >> > >>>> >> > >>>> Pierre >> > >>>> >> > >>>> >> > >>>> 2010/8/20 Scott Gray <scott.g...@hotwaxmedia.com> >> > >>>> >> > >>>>> Hi Pierre, >> > >>>>> >> > >>>>> You'll want to use delegator.findList(...) with an >> EntityOperator.IN >> > >>>>> condition for the experience field. >> > >>>>> >> > >>>>> Regards >> > >>>>> Scott >> > >>>>> >> > >>>>> HotWax Media >> > >>>>> http://www.hotwaxmedia.com >> > >>>>> >> > >>>>> On 20/08/2010, at 10:31 PM, Pierre Smits wrote: >> > >>>>> >> > >>>>>> In a url I pass following parameters: >> > >>>>>> >> > >>>>>> ?profile=10000&experience=10000,100010 >> > >>>>>> >> > >>>>>> In a groovy file I get the parameters.... >> > >>>>>> parameter.profile >> > >>>>>> parameter.experience >> > >>>>>> >> > >>>>>> My question is: how do I get the delegator to find entities in >> the >> > >>>>> database >> > >>>>>> based on both parameter.profile and parameter.experience? >> > >>>>>> >> > >>>>>> In all the other codes in groovy files that I see it seems that >> > >>>>> parameters >> > >>>>>> have only 1 value... Or I might be overlooking one... >> > >>>>>> >> > >>>>>> Regards,, >> > >>>>>> >> > >>>>>> Pierre >> > >>>>> >> > >>>>> >> > >>> >> > >>> >> > >> >> > >> > >> >> >