You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "JFradkin@styleline.com" <JF...@styleline.com> on 2014/09/22 21:35:10 UTC

widget logic help

I am working with the requirement screens.
On a screen it calls a form.
The form is a list, before it calls the form it puts a hyperlink to add a
new role.
I am working on ListRequirementRoles.
I want to change the behavior so if there is a role it does not have the add
role, and if the list is empty it displays the hyperlink.
This is pretty easy in ftl. I spent all day tryong to get a working method
using the requirementscreens.xml
When I check for the list
                <entity-one entity-name="Requirement"
value-field="requirement" auto-field-map="true"/>
                <entity-and entity-name="RequirementRole"
list="requirementRoles">
                    <field-map from-field="requirementId"
field-name="requirementId"/>
                </entity-and>
using 
                                    <condition><not><if-empty
field="requirementRoles"/></not></condition>
I can display the widget or the failed widget, but the failed widget does
not seem to have any of the values set in my actions.
I could do it on my form (added a second form called new role), but if it
did not use a list type I could not seem to see the list, if I made it a
list, but there were no records I could seem to get the hyperlink to show
up.

Just thought I would ask if any of you experienced folks have the syntax to
get one row out of the roles entity so I can have a non list form and check
a value to say display hyperlink?

I am going to do it in FTL for now, as I know the syntax, but thought I
would ask for next time.
Maybe I completely do not understand compare in general, or use when on the
forms. I would of thought I could just do some compare to say if I am going
to show the hyperlink on the screen and would not of needed an additional
form etc.



-----
Joel Fradkin
--
View this message in context: http://ofbiz.135035.n4.nabble.com/widget-logic-help-tp4655953.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: widget logic help

Posted by "joelfradkin@gmail.com" <jo...@gmail.com>.
Sorry,
I thought I mentioned the screen name.
I was just trying to not show the add link if the list had content.

I ended up using a ftl where I check to see if there is no content or if
there is if the through date is before today, so it will not have two
suppliers for the same time period.

I could of sworn it did that for assigning suppliers before, where adding a
new on automatically added the through date, but does not seem to do that
now.



-----
Joel Fradkin
--
View this message in context: http://ofbiz.135035.n4.nabble.com/widget-logic-help-tp4655953p4656036.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: widget logic help

Posted by "joelfradkin@gmail.com" <jo...@gmail.com>.
    <screen name="ListRequirementRoles">
        <section>
            <actions>
                <set field="titleProperty"
value="PageTitleListRequirementRoles"/>
                <set field="headerItem" value="requirement"/>
                <set field="tabButtonItem" value="ListRequirementRolesTab"/>

                <set field="requirementId"
from-field="parameters.requirementId"/>
                <entity-one entity-name="Requirement"
value-field="requirement" auto-field-map="true"/>
                <entity-and entity-name="RequirementRole"
list="requirementRoles">
                    <field-map from-field="requirementId"
field-name="requirementId"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonRequirementDecorator">
                    <decorator-section name="body">
                        <screenlet
title="${uiLabelMap.PageTitleListRequirementRoles}">
                            <condition><if-empty
field="requirementRoles"/></condition>
                            <container>
                                <link target="EditRequirementRole"
text="${uiLabelMap.CommonNew}" style="buttontext">
                                    <parameter param-name="requirementId"/>
                                </link>
                                <link
target="autoAssignRequirementToSupplier"
text="${uiLabelMap.OrderAutoAssign}" style="buttontext">
                                    <parameter param-name="requirementId"/>
                                </link>
                            </container>
                            <include-form name="ListRequirementRoles"
location="component://order/widget/ordermgr/RequirementForms.xml"/>
                        </screenlet>
                   </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>




-----
Joel Fradkin
--
View this message in context: http://ofbiz.135035.n4.nabble.com/widget-logic-help-tp4655953p4656035.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: widget logic help

Posted by Nicolas Malin <ma...@librenberry.net>.
I need your source code to help you, just with a description it really 
hot :)

Nicolas

Le 23/09/2014 22:38, JFradkin@styleline.com a écrit :
> I believe I had it sort of working using xml, but when I added the if clause
> it appeared to cancel the whole widget. The failed widget did not seem to
> have the entities and such.
> I really just wanted it to not do the hyperlink part of the page but do the
> include with data from actions.
> Worked out ok in FTL, I had to add more logic anyhow.
>
>
>
> -----
> Joel Fradkin
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/widget-logic-help-tp4655953p4656004.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: widget logic help

Posted by "JFradkin@styleline.com" <JF...@styleline.com>.
I believe I had it sort of working using xml, but when I added the if clause
it appeared to cancel the whole widget. The failed widget did not seem to
have the entities and such.
I really just wanted it to not do the hyperlink part of the page but do the
include with data from actions.
Worked out ok in FTL, I had to add more logic anyhow.



-----
Joel Fradkin
--
View this message in context: http://ofbiz.135035.n4.nabble.com/widget-logic-help-tp4655953p4656004.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: widget logic help

Posted by "JFradkin@styleline.com" <JF...@styleline.com>.
Thank you for the help.
I completed this using ftl where I could just check if the list had content.
I later modified as I realized users may wish to keep history (more then one
supplier).
I changed the logic in the ftl to verify that there were no suppliers with
no closing and that the closing if there was prior to now. In this way it
keeps them from having two current suppliers.
If you have two current suppliers it will create P.O. for both with the same
order quantity (not half or anything, so would duplicate the order). I
verified if one was off by close date it did not create a P.O. for them.
This way they can have historic suppliers etc, but still only have one
active.
I also modified the drop down for selecting supplier to only display
suppliers (was showing all parties).



-----
Joel Fradkin
--
View this message in context: http://ofbiz.135035.n4.nabble.com/widget-logic-help-tp4655953p4656003.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: widget logic help

Posted by Nicolas Malin <ma...@librenberry.net>.
Try this :

<entity-one entity-name="Requirement" value-field="requirement"/>
<entity-and entity-name="RequirementRole" list="requirementRoles">
    <field-map from-field="requirement.requirementId" field-name="requirementId"/>
</entity-and>

...

<condition>
   <not><if-empty field="requirementRoles"/></not>
</condition>


Or

<entity-one entity-name="Requirement" value-field="requirement"/>

<get-related relation-name="RequirementRole" list="requirementRoles" value-field="requirement"/>
...
<condition>
   <not><if-empty field="requirementRoles"/></not>
</condition>


Nicolas

Le 22/09/2014 21:35, JFradkin@styleline.com a écrit :
>                  <entity-one entity-name="Requirement"
> value-field="requirement" auto-field-map="true"/>
>                  <entity-and entity-name="RequirementRole"
> list="requirementRoles">
>                      <field-map from-field="requirementId"
> field-name="requirementId"/>
>                  </entity-and>
> using
>                                      <condition><not><if-empty
> field="requirementRoles"/></not></condition>