How to set a screen parameter for beanshell usage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set a screen parameter for beanshell usage

madppiper-2
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")
Reply | Threaded
Open this post in threaded view
|

Re: How to set a screen parameter for beanshell usage

BJ Freeman
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")
Reply | Threaded
Open this post in threaded view
|

Re: How to set a screen parameter for beanshell usage

Adrian Crum-2
In reply to this post by madppiper-2
In the bsh file, use

globalContext.get("boxno");

-Adrian


--- On Fri, 11/28/08, madppiper <[hidden email]> wrote:

> From: madppiper <[hidden email]>
> Subject: How to set a screen parameter for beanshell usage
> To: [hidden email]
> 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.


     
Reply | Threaded
Open this post in threaded view
|

Re: How to set a screen parameter for beanshell usage

Vikas Mayur-3
In reply to this post by madppiper-2

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.
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

hyperlink & submit in widget form

Jacek Wagner
In reply to this post by madppiper-2
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
Reply | Threaded
Open this post in threaded view
|

Re: hyperlink & submit in widget form

madppiper-2

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
Reply | Threaded
Open this post in threaded view
|

Re: hyperlink & submit in widget form

BJ Freeman
In reply to this post by Jacek Wagner
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
>
>
Reply | Threaded
Open this post in threaded view
|

Re: hyperlink & submit in widget form

Jacek Wagner
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.
Reply | Threaded
Open this post in threaded view
|

Possible error in ofbiz?

Jacek Wagner
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

Reply | Threaded
Open this post in threaded view
|

Re: Possible error in ofbiz?

guo weizhan
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 <[hidden email]>

> 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
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Possible error in ofbiz?

BJ Freeman
In reply to this post by Jacek Wagner
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
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Possible error in ofbiz?

Jacek Wagner
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
>>
>>
>>
>>    

Reply | Threaded
Open this post in threaded view
|

Re: Possible error in ofbiz?

BJ Freeman
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
>>>
>>>
>>>
>>>    
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Possible error in ofbiz?

David E Jones-3

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
>>>>
>>>>
>>>>
>>>>
>>
>>
>>