You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by madppiper <pa...@mutschler.ch> on 2008/11/28 14:00:53 UTC

How to set a screen parameter for beanshell usage

Hi,

whether it was possible to set a parameter in the screens.xml file and
access the very same in a beanshell. I'm quite certain that there must be a
way, but the following doesn't work and I cannot find any examples:

<set field="boxno" value="3" type="String" global="true"/>

<script location="component://[...].bsh" />



and in the bsh file i use:

context.get("boxno")
-- 
View this message in context: http://www.nabble.com/How-to-set-a-screen-parameter-for-beanshell-usage-tp20734025p20734025.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: How to set a screen parameter for beanshell usage

Posted by Vikas Mayur <vi...@hotwaxmedia.com>.
Any thing that has been set in screen context is available in the  
beanshell file.
In beanshell file this can be achieved either by doing (temp is a  
variable to assign the parameter value)

temp = boxno;
or
temp = context.get("boxno");

Both of above examples has same effect.


Vikas

On Nov 28, 2008, at 6:30 PM, madppiper wrote:

>
> Hi,
>
> whether it was possible to set a parameter in the screens.xml file and
> access the very same in a beanshell. I'm quite certain that there  
> must be a
> way, but the following doesn't work and I cannot find any examples:
>
> <set field="boxno" value="3" type="String" global="true"/>
>
> <script location="component://[...].bsh" />
>
>
>
> and in the bsh file i use:
>
> context.get("boxno")
> -- 
> View this message in context: http://www.nabble.com/How-to-set-a-screen-parameter-for-beanshell-usage-tp20734025p20734025.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Re: Possible error in ofbiz?

Posted by David E Jones <da...@hotwaxmedia.com>.
Actually no, it is just a simple-method warning to let you know there  
is no value when an operation implied there would be.

-David


On Dec 2, 2008, at 1:57 PM, BJ Freeman wrote:

> could also mean that there is no field by that name.
>
> Jacek Wagner sent the following on 12/2/2008 8:38 AM:
>> It was one of the most confusing messages in the log.
>> .... Field value not found with name productPrice in Map with  
>> name ....
>>
>> really meant that  query did not  return  any  value; data not syntax
>> problem
>>
>> BJ Freeman wrote:
>>> https://demo.hotwaxmedia.com/webtools/control/FindGeneric?entityName=ProductPrice&find=true&VIEW_SIZE=50&VIEW_INDEX=0
>>>
>>> no producPrice in the Entity.
>>> try price.
>>> also
>>> https://demo.hotwaxmedia.com/webtools/control/ViewRelations?entityName=ProductPrice
>>>
>>> to find the FK names which are not fields.
>>>
>>> Jacek Wagner sent the following on 12/1/2008 5:24 PM:
>>>
>>>> All,
>>>>
>>>> Below are two almost identical simple methods. When tested thru
>>>> WebToolsService/Service Reference the first getBirthdayParty  
>>>> works the
>>>> second
>>>> getProductPrice produces exception 2008-12-01 17:13:17,641
>>>> (http-0.0.0.0-8443-Processor4) [      FieldToResult.java:66 :WARN ]
>>>> Field value not found with name productPrice in Map with name
>>>>
>>>>   <simple-method method-name="getBirthdayParty"
>>>> short-description="Retrieve birthday party information">
>>>>       <!-- find the birthday party record -->
>>>>       <make-value value-name="lookupPKMap"
>>>> entity-name="RegistrationBirthdayParty"/>
>>>>       <set-pk-fields map-name="parameters" value- 
>>>> name="lookupPKMap"/>
>>>>       <find-by-primary-key entity-name="RegistrationBirthdayParty"
>>>> map-name="lookupPKMap" value-name="bpiValue"/>
>>>>       <field-to-result field-name="bpiValue"
>>>> result-name="bpinformation"/>
>>>>   </simple-method>
>>>>     <simple-method method-name="getProductPrice"
>>>> short-description="Retrieve product price information">
>>>>       <!-- find product price record -->
>>>>       <make-value value-name="lookupPKMap"
>>>> entity-name="ProductPrice"/>              <set-pk-fields
>>>> map-name="parameters" value-name="lookupPKMap"/>
>>>>       <find-by-primary-key entity-name="ProductPrice"
>>>> map-name="lookupPKMap" value-name="productPrice"/>
>>>>       <field-to-result field-name="productPrice" result- 
>>>> name="pprice"/>
>>>>   </simple-method>
>>>>
>>>> Jacek
>>>>
>>>>
>>>>
>>>>
>>
>>
>>


Re: Possible error in ofbiz?

Posted by BJ Freeman <bj...@free-man.net>.
could also mean that there is no field by that name.

Jacek Wagner sent the following on 12/2/2008 8:38 AM:
> It was one of the most confusing messages in the log.
> .... Field value not found with name productPrice in Map with name ....
> 
> really meant that  query did not  return  any  value; data not syntax
> problem
> 
> BJ Freeman wrote:
>> https://demo.hotwaxmedia.com/webtools/control/FindGeneric?entityName=ProductPrice&find=true&VIEW_SIZE=50&VIEW_INDEX=0
>>
>> no producPrice in the Entity.
>> try price.
>> also
>> https://demo.hotwaxmedia.com/webtools/control/ViewRelations?entityName=ProductPrice
>>
>> to find the FK names which are not fields.
>>
>> Jacek Wagner sent the following on 12/1/2008 5:24 PM:
>>  
>>> All,
>>>
>>> Below are two almost identical simple methods. When tested thru
>>> WebToolsService/Service Reference the first getBirthdayParty works the
>>> second
>>> getProductPrice produces exception 2008-12-01 17:13:17,641
>>> (http-0.0.0.0-8443-Processor4) [      FieldToResult.java:66 :WARN ]
>>> Field value not found with name productPrice in Map with name
>>>
>>>    <simple-method method-name="getBirthdayParty"
>>> short-description="Retrieve birthday party information">
>>>        <!-- find the birthday party record -->
>>>        <make-value value-name="lookupPKMap"
>>> entity-name="RegistrationBirthdayParty"/>
>>>        <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
>>>        <find-by-primary-key entity-name="RegistrationBirthdayParty"
>>> map-name="lookupPKMap" value-name="bpiValue"/>
>>>        <field-to-result field-name="bpiValue"
>>> result-name="bpinformation"/>
>>>    </simple-method>
>>>      <simple-method method-name="getProductPrice"
>>> short-description="Retrieve product price information">
>>>        <!-- find product price record -->
>>>        <make-value value-name="lookupPKMap"
>>> entity-name="ProductPrice"/>              <set-pk-fields
>>> map-name="parameters" value-name="lookupPKMap"/>
>>>        <find-by-primary-key entity-name="ProductPrice"
>>> map-name="lookupPKMap" value-name="productPrice"/>
>>>        <field-to-result field-name="productPrice" result-name="pprice"/>
>>>    </simple-method>
>>>
>>> Jacek
>>>
>>>
>>>
>>>     
> 
> 
> 

Re: Possible error in ofbiz?

Posted by Jacek Wagner <ja...@berkeley.edu>.
It was one of the most confusing messages in the log. 

.... Field value not found with name productPrice in Map with name ....

really meant that  query did not  return  any  value; data not syntax 
problem

BJ Freeman wrote:
> https://demo.hotwaxmedia.com/webtools/control/FindGeneric?entityName=ProductPrice&find=true&VIEW_SIZE=50&VIEW_INDEX=0
> no producPrice in the Entity.
> try price.
> also
> https://demo.hotwaxmedia.com/webtools/control/ViewRelations?entityName=ProductPrice
> to find the FK names which are not fields.
>
> Jacek Wagner sent the following on 12/1/2008 5:24 PM:
>   
>> All,
>>
>> Below are two almost identical simple methods. When tested thru
>> WebToolsService/Service Reference the first getBirthdayParty works the
>> second
>> getProductPrice produces exception 2008-12-01 17:13:17,641
>> (http-0.0.0.0-8443-Processor4) [      FieldToResult.java:66 :WARN ]
>> Field value not found with name productPrice in Map with name
>>
>>    <simple-method method-name="getBirthdayParty"
>> short-description="Retrieve birthday party information">
>>        <!-- find the birthday party record -->
>>        <make-value value-name="lookupPKMap"
>> entity-name="RegistrationBirthdayParty"/>
>>        <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
>>        <find-by-primary-key entity-name="RegistrationBirthdayParty"
>> map-name="lookupPKMap" value-name="bpiValue"/>
>>        <field-to-result field-name="bpiValue" result-name="bpinformation"/>
>>    </simple-method>
>>      <simple-method method-name="getProductPrice"
>> short-description="Retrieve product price information">
>>        <!-- find product price record -->
>>        <make-value value-name="lookupPKMap"
>> entity-name="ProductPrice"/>              <set-pk-fields
>> map-name="parameters" value-name="lookupPKMap"/>
>>        <find-by-primary-key entity-name="ProductPrice"
>> map-name="lookupPKMap" value-name="productPrice"/>
>>        <field-to-result field-name="productPrice" result-name="pprice"/>
>>    </simple-method>
>>
>> Jacek
>>
>>
>>
>>     


Re: Possible error in ofbiz?

Posted by BJ Freeman <bj...@free-man.net>.
https://demo.hotwaxmedia.com/webtools/control/FindGeneric?entityName=ProductPrice&find=true&VIEW_SIZE=50&VIEW_INDEX=0
no producPrice in the Entity.
try price.
also
https://demo.hotwaxmedia.com/webtools/control/ViewRelations?entityName=ProductPrice
to find the FK names which are not fields.

Jacek Wagner sent the following on 12/1/2008 5:24 PM:
> All,
> 
> Below are two almost identical simple methods. When tested thru
> WebToolsService/Service Reference the first getBirthdayParty works the
> second
> getProductPrice produces exception 2008-12-01 17:13:17,641
> (http-0.0.0.0-8443-Processor4) [      FieldToResult.java:66 :WARN ]
> Field value not found with name productPrice in Map with name
> 
>    <simple-method method-name="getBirthdayParty"
> short-description="Retrieve birthday party information">
>        <!-- find the birthday party record -->
>        <make-value value-name="lookupPKMap"
> entity-name="RegistrationBirthdayParty"/>
>        <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
>        <find-by-primary-key entity-name="RegistrationBirthdayParty"
> map-name="lookupPKMap" value-name="bpiValue"/>
>        <field-to-result field-name="bpiValue" result-name="bpinformation"/>
>    </simple-method>
>      <simple-method method-name="getProductPrice"
> short-description="Retrieve product price information">
>        <!-- find product price record -->
>        <make-value value-name="lookupPKMap"
> entity-name="ProductPrice"/>              <set-pk-fields
> map-name="parameters" value-name="lookupPKMap"/>
>        <find-by-primary-key entity-name="ProductPrice"
> map-name="lookupPKMap" value-name="productPrice"/>
>        <field-to-result field-name="productPrice" result-name="pprice"/>
>    </simple-method>
> 
> Jacek
> 
> 
> 

Re: Possible error in ofbiz?

Posted by guo weizhan <gu...@gmail.com>.
It seems you didn't get the entity correctly. Check the parameters to see is
there the right parameters you passed.

2008/12/2 Jacek Wagner <ja...@berkeley.edu>

> All,
>
> Below are two almost identical simple methods. When tested thru
> WebToolsService/Service Reference the first getBirthdayParty works the
> second
> getProductPrice produces exception 2008-12-01 17:13:17,641
> (http-0.0.0.0-8443-Processor4) [      FieldToResult.java:66 :WARN ] Field
> value not found with name productPrice in Map with name
>
>   <simple-method method-name="getBirthdayParty" short-description="Retrieve
> birthday party information">
>       <!-- find the birthday party record -->
>       <make-value value-name="lookupPKMap"
> entity-name="RegistrationBirthdayParty"/>
>       <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
>       <find-by-primary-key entity-name="RegistrationBirthdayParty"
> map-name="lookupPKMap" value-name="bpiValue"/>
>       <field-to-result field-name="bpiValue" result-name="bpinformation"/>
>   </simple-method>
>     <simple-method method-name="getProductPrice"
> short-description="Retrieve product price information">
>       <!-- find product price record -->
>       <make-value value-name="lookupPKMap" entity-name="ProductPrice"/>
>         <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
>       <find-by-primary-key entity-name="ProductPrice"
> map-name="lookupPKMap" value-name="productPrice"/>
>       <field-to-result field-name="productPrice" result-name="pprice"/>
>   </simple-method>
>
> Jacek
>
>

Possible error in ofbiz?

Posted by Jacek Wagner <ja...@berkeley.edu>.
All,

Below are two almost identical simple methods. When tested thru 
WebToolsService/Service Reference the first getBirthdayParty works the 
second
getProductPrice produces exception 2008-12-01 17:13:17,641 
(http-0.0.0.0-8443-Processor4) [      FieldToResult.java:66 :WARN ] 
Field value not found with name productPrice in Map with name

    <simple-method method-name="getBirthdayParty" 
short-description="Retrieve birthday party information">
        <!-- find the birthday party record -->
        <make-value value-name="lookupPKMap" 
entity-name="RegistrationBirthdayParty"/>
        <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
        <find-by-primary-key entity-name="RegistrationBirthdayParty" 
map-name="lookupPKMap" value-name="bpiValue"/>
        <field-to-result field-name="bpiValue" result-name="bpinformation"/>
    </simple-method>
   
    <simple-method method-name="getProductPrice" 
short-description="Retrieve product price information">
        <!-- find product price record -->
        <make-value value-name="lookupPKMap" 
entity-name="ProductPrice"/>       
        <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
        <find-by-primary-key entity-name="ProductPrice" 
map-name="lookupPKMap" value-name="productPrice"/>
        <field-to-result field-name="productPrice" result-name="pprice"/>
    </simple-method>

Jacek


Re: hyperlink & submit in widget form

Posted by Jacek Wagner <ja...@berkeley.edu>.
BJ Freeman wrote:
> the way this is handled in ofbiz is thru the controller.
> you submit is a url to a request-map then then can be directed to a new view
>
> Jacek Wagner sent the following on 12/1/2008 8:55 AM:
>   
>> Hi,
>>
>> Is it possible to merge submit and hyperlink. In other words I would
>> like to have form where a single click will update a form/table and pass
>> control to the next  screen.
>>
>> Jacek
>>
>>
>>     
Works just like I wanted. Thank you.

Re: hyperlink & submit in widget form

Posted by BJ Freeman <bj...@free-man.net>.
the way this is handled in ofbiz is thru the controller.
you submit is a url to a request-map then then can be directed to a new view

Jacek Wagner sent the following on 12/1/2008 8:55 AM:
> Hi,
> 
> Is it possible to merge submit and hyperlink. In other words I would
> like to have form where a single click will update a form/table and pass
> control to the next  screen.
> 
> Jacek
> 
> 

Re: hyperlink & submit in widget form

Posted by madppiper <pa...@mutschler.ch>.

Can't you forward with the correct parameters after processing the form
data?



Jacek Wagner wrote:
> 
> Hi,
> 
> Is it possible to merge submit and hyperlink. In other words I would 
> like to have form where a single click will update a form/table and pass 
> control to the next  screen.
> 
> Jacek
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-a-screen-parameter-for-beanshell-usage-tp20734025p20779385.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


hyperlink & submit in widget form

Posted by Jacek Wagner <ja...@berkeley.edu>.
Hi,

Is it possible to merge submit and hyperlink. In other words I would 
like to have form where a single click will update a form/table and pass 
control to the next  screen.

Jacek

Re: How to set a screen parameter for beanshell usage

Posted by BJ Freeman <bj...@free-man.net>.
screen widgets are meant for display. the processing by scripts is to
get the data ready to display on a page.
the decision as to which screen is done through the controller, and an
event, service, or just a request, that returns a string that determines
which view (screen) to use.
what you propose is not in the normal way ofbiz works.
however if you have one FTL that has all the templates in it.
then you can pass a parameter to the FTL from the script as to what to
display, and select the specific template in the FTL.



madppiper sent the following on 11/28/2008 5:00 AM:
> Hi,
> 
> whether it was possible to set a parameter in the screens.xml file and
> access the very same in a beanshell. I'm quite certain that there must be a
> way, but the following doesn't work and I cannot find any examples:
> 
> <set field="boxno" value="3" type="String" global="true"/>
> 
> <script location="component://[...].bsh" />
> 
> 
> 
> and in the bsh file i use:
> 
> context.get("boxno")

Re: How to set a screen parameter for beanshell usage

Posted by Adrian Crum <ad...@yahoo.com>.
In the bsh file, use

globalContext.get("boxno");

-Adrian


--- On Fri, 11/28/08, madppiper <pa...@mutschler.ch> wrote:

> From: madppiper <pa...@mutschler.ch>
> Subject: How to set a screen parameter for beanshell usage
> To: user@ofbiz.apache.org
> Date: Friday, November 28, 2008, 5:00 AM
> Hi,
> 
> whether it was possible to set a parameter in the
> screens.xml file and
> access the very same in a beanshell. I'm quite certain
> that there must be a
> way, but the following doesn't work and I cannot find
> any examples:
> 
> <set field="boxno" value="3"
> type="String" global="true"/>
> 
> <script location="component://[...].bsh" />
> 
> 
> 
> and in the bsh file i use:
> 
> context.get("boxno")
> -- 
> View this message in context:
> http://www.nabble.com/How-to-set-a-screen-parameter-for-beanshell-usage-tp20734025p20734025.html
> Sent from the OFBiz - User mailing list archive at
> Nabble.com.