RE: Re: How to retrieve information in database with groovy OFBiz?

2022-06-13 Thread Dibe koffi
Hi Jacques,
Thanks you, i did not read these page. Hi will take a look.

Koffi.

On 2022/06/12 09:01:01 Jacques Le Roux wrote:
> Hi Koffi,
> 
> I suppose that you have used/followed 
> https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide+for+18.12
>  to 
> create your component
> 
> Anyway, your reasoning sounds good, and not looking at all details, at 1st 
> glance your code sounds enough for a start.
> For instance I suppose list.ftl is in the groovyScripts folder in 
> ParcAutomobile, where it should not be but in a template folder, but let's 
> suppose 
> that's OK.
> 
> So you have a request-map in your ParcAutomobile controller, called from the 
> car screen, and you pass the carId parameter to the carDetail screen.
> 
> Then, what do you see in console.log?
> 
> If you did not already, I recommend you to read/view this page 
> https://cwiki.apache.org/confluence/display/OFBIZ/Framework+Introduction+Videos+and+Diagrams
>  when you get time,
> particularly 
> https://cwiki.apache.org/confluence/download/attachments/7045155/18ArtRefDia.pdf?version=1&modificationDate=1267053493000&api=v2
> Of course BSH is now Groovy.
> 
> HTH
> 
> Jacques
> 
> Le 12/06/2022 à 01:05, Dibe koffi a écrit :
> > Hi,
> > I’m koffi a beginner OFBiz developper. I’m facing a problem while 
> > developing car rental Application
> >
> > I want to do this: I define an entity named “Car" with primary key “carId", 
> > and I would like to display Car informations on a screen named “carDetai"l 
> > by sending  the “carId"
> >
> > There is a screen named “car" in which a put a link to the carDetail with 
> > parameter carId. When a click on this link the parameter will be send to 
> > the screen carDetail which will run groovy script to fetch the 
> > corresponding car. Then the result ( the match car ) will be then send to 
> > freeMarker template to be displayed.
> >
> > Here is the code:
> >
> > 
> >  
> >  
> >  
> >  

Re: How to retrieve information in database with groovy OFBiz?

2022-06-12 Thread Jacques Le Roux

Hi Koffi,

I suppose that you have used/followed https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide+for+18.12 to 
create your component


Anyway, your reasoning sounds good, and not looking at all details, at 1st 
glance your code sounds enough for a start.
For instance I suppose list.ftl is in the groovyScripts folder in ParcAutomobile, where it should not be but in a template folder, but let's suppose 
that's OK.


So you have a request-map in your ParcAutomobile controller, called from the 
car screen, and you pass the carId parameter to the carDetail screen.

Then, what do you see in console.log?

If you did not already, I recommend you to read/view this page 
https://cwiki.apache.org/confluence/display/OFBIZ/Framework+Introduction+Videos+and+Diagrams when you get time,

particularly 
https://cwiki.apache.org/confluence/download/attachments/7045155/18ArtRefDia.pdf?version=1&modificationDate=1267053493000&api=v2
Of course BSH is now Groovy.

HTH

Jacques

Le 12/06/2022 à 01:05, Dibe koffi a écrit :

Hi,
I’m koffi a beginner OFBiz developper. I’m facing a problem while developing 
car rental Application

I want to do this: I define an entity named “Car" with primary key “carId", and I would 
like to display Car informations on a screen named “carDetai"l by sending  the “carId"

There is a screen named “car" in which a put a link to the carDetail with 
parameter carId. When a click on this link the parameter will be send to the screen 
carDetail which will run groovy script to fetch the corresponding car. Then the 
result ( the match car ) will be then send to freeMarker template to be displayed.

Here is the code:


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



The groovy script

carId = parameters.carId
context.carId = carId
car = from("Car").where("carId", carId).queryOne()
context.car = car

freeMarker template



<#if car?has_content>

 
 ${uiLabelMap.CarId}
 ${car.carId}
 
 
 ${uiLabelMap.Modele}
 ${car.modele}
 





In order to avoid writing all car informations, before be sur it workin,  I 
just display to value. I expect to get see these informations but a got a blank 
page, I don’t know where exactly what is going wrong.


Thanks in advance.



BADJO koffi