Hi Scott,

This solution would probably lead to running out of space in the
query_string, as there are still some limits regarding the length.

But thanks for the support and heads up.

Regards,

Pierre

2010/8/24 Scott Gray <scott.g...@hotwaxmedia.com>

> Hi Pierre,
>
> I believe the correct way to send multiple values for the same key as part
> of a query string is like this:
> ?profileSummaryId=10091&experienceSelected=10003&experienceSelected=10020
> That should result in parameters.experienceSelected being a list containing
> the two values and would avoid you have to split the string yourself.
>
> Regards
> Scott
>
> On 24/08/2010, at 12:47 AM, Pierre Smits wrote:
>
> > Hi Scott,
> >
> > I think I've got it solved.
> > First I use:
> > String delims = "[,]";
> > String[] experienceTokens = selectedExperiences.split(delims);
> >
> > to split the query_string to a list. And subsequently I use
> >
> condList.add(EntityCondition.makeCondition("experienceId",EntityOperator.IN,
> experienceTokens as List));
> >
> > to add the items in the query string as conditions.
> >
> > This renders:
> > cond = (profileOwnerId= '10010, experienceId IN('10010','10003'))
> >
> > And finally I get my pdf with both experiences.
> >
> > And if I don't send any experienceId's in the query string I get all
> experiences associated with profileOwnerId (which is what I want).:)
> >
> > Thanks for your patience and help.
> >
> > Regards,
> >
> > Pierre
> >
> > 2010/8/23 Pierre Smits <pierre.sm...@gmail.com>
> > When removing 'as list' from the groovy code, I get following error:
> >
> > Problems with the response writer/output stream:
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://profiler/widget/ProfilerPrintScreens.xml#PrintProfilePDF]:
> java.lang.ClassCastException: java.lang.String cannot be cast to
> java.util.Collection (java.lang.String cannot be cast to
> java.util.Collection)
> >
> > In my input form (a combination of two) I indeed use a checkbox solution
>  to select the experiences: These checkboxes have the same input name. I
> then use some javascript code to generate the url and open a new window
> which has the query_string:
> ?profileSummaryId=10091&experienceSelected=10003,10020
> >
> >
> >
> >
> > 2010/8/23 Scott Gray <scott.g...@hotwaxmedia.com>
> > Try removing the "as List" in the entity condition (I checked and an
> array parameter value is automatically converted to a list of values).  If
> that doesn't work, what do the form inputs for experienceId look like?  You
> should have multiple input fields (checkboxes I guess) sharing the same
> experienceId input name.
> >
> > Regards
> > Scott
> >
> > On 23/08/2010, at 10:07 PM, Pierre Smits wrote:
> >
> > > 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&#47;output stream&#58;
> > > > >>
> > > > >> org.ofbiz.widget.screen.ScreenRenderException&#58;
> > > > >> Error rendering screen
> &#91;component&#58;&#47;&#47;profiler&#47;widget&#47;ProfilerPrintScreens.xml&#35;PrintProfilePDF&#93;&#58;
> > > > >>
> > > > >> groovy.lang.MissingPropertyException&#58; No such property&#58;
> > > > >> EntityCondition for class&#58; ProfileExperiences &#40;No such
> property&#58; EntityCondition for class&#58; ProfileExperiences&#41;
> > > > >>
> > > > >> </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
> > > > >>>>>
> > > > >>>>>
> > > > >>>
> > > > >>>
> > > > >>
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>

Reply via email to