Backoffice : How to filter Date entries based on Year using referenceSearchCondition in Create/Editor Wizard - sap-commerce-cloud

SAP Commerce 1811
We have a model like this ..
HolidayCalendar has an attribute Year of Integer type and collection of Holiday Calendar Entries.
HolidayCalendarEntry has attribute Date
In Backoffice -> Create/Editor Wizard, i want to apply referenceSearchCondition filter on HolidayCalendar:Entries attribute so that whenever i choose existing entries in Holiday Calendar i can get only those entries fall under associated year.
e.g. I created new Holiday Calendar of 2021, then i can see only those entries which has date of 2021.
So far I tried something with Dynamic Form but its not working
<context type="HolidayCalendar" component="editorAreaDynamicForms" merge-by="module">
<df:dynamicForms xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms">
<df:attribute id="dynamicFormsEntryFiltering1" paramName="referenceSearchCondition_date_greaterOrEquals" disabledIf="date==null" computedValue="T(com.hybris.util.DateUtils).getFirstDay(parentObject.year)" qualifier="entries" triggeredOn="date"/>
</df:dynamicForms>
</context>
<context type="HolidayCalendar" component="editorAreaDynamicForms" merge-by="module">
<df:dynamicForms xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms">
<df:attribute id="dynamicFormsEntryFiltering2" paramName="referenceSearchCondition_date_lessOrEquals" disabledIf="date==null" computedValue="T(com.hybris.util.DateUtils).getLastDay(parentObject.year)" qualifier="entries" triggeredOn="date"/>
</df:dynamicForms>
</context>
Here I am trying to set a range of FirstDay and LastDay of Holiday Calendar Year and match entries date fall under it. But it's not working.
Any other suggestion how to achieve this ?

You can create a custom editor for "entries" attribute,
public class EntriesEditor<T> extends DefaultMultiReferenceEditor<T>
Override the method and add your filter condition within this method
updateReferencesListBoxModel
Reference this custom editor in your config.xml,
<wz:property qualifier="entries" editor="com.backoffice.editors.entrieseditor" />

Related

NetSuite: Populate custom item field value on transaction custom column field

I have 3 free-text custom fields on inventory item record. they contain different information based on location so my fields names are "XXXX Location1", "XXXX Location2" and "XXXX Location3". Across all transactions in the system we need to populate the information in a custom column field of these 3 fields based on the main location we choose on that transaction.
For example if on an Invoice the Main location is Location1 then our line custom column field should show information from "XXXX Location1" when user choose that item on the line; if Main location is Location2 on that Invoice then the line custom column field should show information from "XXXX Location2" when select that item on the line.
I understand this needs to be done thru scripts but i don't know how to write the script, could someone help?
Appreciate!!!
You don't need a script for that.
On the colmn field, set the field to be a formula.
In the formula, write the followin statement(change to real location names and real item custom field ids):
Case {location}
When "location1 name" then {item.custitem... }
When "location2 name" then {item.custitem.. }
When "location3 name" then {item.custitem...}
End

Active Scaffold: how to filter the query

I need to filter my query in active scaffold 3.2.19 to display only customers that have the field "end_date" >= current date or "end_date" is null.
I already tried to use conditions_for_collection, but if my user needs to filter the costumers that have end_date is not null or <= current date he will can't, so I tried to use field_search.default_params but i can't understand how to use.
Any ideas???
thanks

Filtering view in lotus notes

good day,
I'm trying to filter date by year using #setviewinfo. can anyone tell me how?
Here is an example, put this formula on PostOpen event on view. It will filter all document by column with user name.
#SetViewInfo([SetViewFilter]; #UserName; "columnName"; 1; 1)
columnName - is a real name of column (you may set it in Column Property)
Remember to clean filter on QueryClose even on view, otherwise all view will use this filter.
example how u should remove filter
#SetTargetFrame("frameName");
#UpdateFormulaContext;
#Command([OpenView]; #Subset(#ViewTitle; -1));
#SetViewInfo([SetViewFilter]; ""; "columnName"; 1)
frameName is a frame that contains view, columnName is your categorized column. If you do not use frame - simply skip 1-st row

Moving date period filter in Excel 2010 pivot-table

Is it possible to set some kind of filter for a moving date period?
For example one of the DB views I'm trying to replicate in my pivot-table has this filter :
DATEDIFF(day, dateColumn, GETDATE()) <= 90
So basically I always want to display the last 90 days of whataver data there is in the cube table.
Is this possible?
The answer to this question is here :
http://blogs.socha.com/2010/05/sliding-date-ranges-with-excel-2010.html
Example for a moving period of 30 days :
Select a cell inside a pivot table bound to the cube so that the PivotTable tools are available
Click the Options tab on the ribbon under the PivotTable Tools section:
Click the Fields, Items & Sets drop-down in the Calculations section of this ribbon tab
Click Manage Sets… in the drop-down
Click New… and then Create Set using MDX…
Enter a name for this set in the Set name text box
Enter the MDX expression that defines the date range
Click OK
Filter(
[Date].[Date].[Date],
[Date].[Date].CurrentMember.Member_Value < Now()
AND [Date].[Date].CurrentMember.Member_Value >= DateAdd("d", -30, VBA![Date]())
)

Sharepoint update Lookup Column

I am trying to update a Lookupvalue field "Items" via the SharePoint object model.
"Products" is a column in one list which is used as a lookup column to another list in field "Items".
In my webpart i have dropdown of Items now
string strItems = ddlItems.SelectedValue.ToString();
item["Items"] = new SPFieldLookupValue("strItems");
item.Update();
However, this is causing an error
Internally, SharePoint stores these references like this:
NumericID;#DisplayValue i.e.
145;#Soup
12;#Cake
874;#Steak
That is the kind of thing that should be in the constructor to SPFieldLookupValue. Or if it is more helpful, use the variant of the constructor that takes an int id and string display value.
More info is laid out here:
http://blogs.msdn.com/b/sridhara/archive/2007/08/25/update-quot-lookup-quot-fields-in-sharepoint-2007.aspx
You need to set the Items column to the ID of the SPItem represented by the product. You could do this by setting the DataTextValue of your dropdown to ID and then using the SelectedValue. You could also do a CAML query when a new item is selected in the dropdown.
You can find more information at the bottom of this blog post:
http://weblogs.asp.net/bsimser/archive/2005/05/13/406734.aspx

Resources