OQL DATA and IMAGE

0
Hello! This is my OQL: ' SELECT DISTINCT      C.BodyType as BodyType,      C.FuelType as FuelType,      S.Name as Name,      S.PricePerDay as PricePerDay,     S.id as Segment_Segment FROM Cars.Car as C LEFT JOIN  C/Cars.Car_Segment/Dicitionaries.Segment/Dicitionaries.SegmentImage_Segment/Dicitionaries.SegmentImage/Dicitionaries.SegmentImage_Segment/Dicitionaries.Segment  as S  LEFT JOIN C/Cars.Car_Booking/Booking.Booking as B WHERE (C.BodyType = ''Sedan'' OR     C.BodyType = ''Hatchback'' OR      C.BodyType = ''Station Wagon'' OR     C.BodyType = ''SUV'' OR      C.BodyType = ''Crossover'' OR      C.BodyType = ''MPV'' OR      C.BodyType = ''Van'' OR     C.BodyType = ''Coupe'' OR     C.BodyType = ''Convertible'' OR     C.BodyType = ''Limousine'' OR     C.BodyType = ''Roadster'' OR     C.BodyType = ''Pickup'')     AND      (C.FuelType = ''Diesel'' OR C.FuelType = ''Petrol'') ' I know that OQL might be simplified but I don't want to fight with it too much (I don’t have any experience with OQLs), it works for now. Basically now presents all of the combinations of SEGMENT BODYTYPE FUELTYPE for each existing Car.  1st issue – for that I’m using also templategrid and inside there I have DynamicImage, that is connected to SEGMENT by association, but Image is not displaying, any tips? 2nd issue – now what I want is to present only those elements in list regard to BOOKING entity => I would like to set StartDate and EndDate in DatePicker and check if there is available Car compared to choose StartDate and EndDate, but here also no idea how can I approach it. Any help will be much appreciated 
asked
1 answers
1

hello Sebastian Kwiatkowski,

solution for issue 1 

check the image Hasbinarycontent attibute is true or not you also can constrain your data by it.

if image still not visible you can access image by Url for that use deep link module

 Mendix Marketplace - Deep link module 

you can show image in mendix by Url also 

solution for issue 2

add two attributes in Booking Entity (Start and End date [DateTime]).

add two input parameter of Datetime type in same MF in which you are Executing OQL.

Now When user select start date and end date on the page call the same MF on change – and pass the Start Date and End  Date.

Now Update your MF 

place decision

if StartDate and End Date !=empty then   go to oql with WHERE Condition with Attribute Start and End Date 

for example 

WHERE Booking StartDate >= $StartDateParamerter and EndDate <= $EndDateParamerter. so data will be filtered after selecting both date

else 

go with your previous OQL which is fetching all data without filter.

 

 

 

answered