Default Value for MultiInput in Smart Filter Bar - sapui5

I am fairly new to the whole UI5 and Fiori world and maybe this is a simple problem.
So far I have created a fiori-elements list report using the SAP Web IDE.
Example Elements Application
In my smart filter bar are shown a few MultiInput fields to filter the data (see: Category field in Example).
For the Category Field I can choose contains and set a value and after I click on OK a Token is placed inside the field and I can Filter the data.
Now I want to prefill this field, so the user does not have to enter it every time.
I tried to add a token programatically by extending the controller and add a new token in onBeforeRendering
onBeforeRendering: function() {`
var multiInput = sap.ui.getCore().byId("...");
multiInput.addToken(new sap.m.Token({text: "myDefaultFilterValue"}));
// tried text: "*myDefaultFilterValue*" (contains)
}
As I would expect the token is visible, but if I click on "Go" the application behaves as if no filter is set.
Do I have to call some update mechanism or somehow use local annotations?

Variant Management might be the solution for your problem:
From the Fiori Design Guidelines https://experience.sap.com/fiori-design-web/variant-management/ :
===========
Intro
Variants store filter settings which have been defined within the filter bar. The filter settings consist of filter parameters, selection fields and a layout. This control enables the user to load, save, and change variants. In some cases, the table settings are also saved within a variant.
In the context of tables, this control is used to save, manage, and load table settings which include layout, column visibility, sorting, and grouping.
Smart variant management saves both filter settings and table layouts. It creates a page variant that includes all the controls. The button is located within the page header bar, and no secondary management is possible on table level.
Usage
Use the variant management control if:
The user needs to save and load different filter settings to find the relevant data.
The user needs to save and load different layouts (for example, a table) to display data in different views.
Use smart variant management if the user needs to save the page, including the filter settings and table layout.
===========
Please see also this blog https://blogs.sap.com/2017/03/23/annotating-and-extending-fiori-element-applications-list-report-part-3/ :
===========
Please note that we have other setting options at our disposal including the control of variant management for our List Report. Variant management allows for storing snapshots of a user’s setting when using your application such as filters within the Smart Filter Bar or visible columns within the Smart Table.
By default, the Smart Filter Bar and Smart Table each have their own variant (See above where both are set to “Standard”). If we use the setting “smartVariantManagement“: true we will now have a unified variant management area for our List Report where variants for both the Smart Filter Bar and Smart Table are saved together.
===========

You can try the below solution, here the key value will be sent to backend and text value will be displayed to user.
var multiInput = sap.ui.getCore().byId("...");
var otoken = new sap.m.Token({
key: 'myDefaultFilterValue',
text: 'myDefaultFilterValue'
});
multiInput.setTokens([otoken]);
Hope this helps you.

Related

odoo 12 show different forms based on state values

How to show different forms on odoo 12 based on state value. I want a switch between the states to alter the form as well while keeping the same tree view of course
you can't have two different form view based on the state from a single tree view. But you can control fields/groups/pages or other elements visibility based on state using the invisible attribute.
One could create a single form create different groups in the form or even further add different notebooks and pages whose visibility can be controlled using attributes and passing in a state change in a domain.

Refer relevant K2 smart objects from different sources in a K2 view

I have recently started working on K2, so please take me as a starter on this one.
SmartObjects
1) I have a SharePoint Smart Object (SpSo1) which lists all vehicle details i.e. ID, make, model, specs etc.
2) And I have a SQL Server Smart Object (SqlSo1) where I am saving only the vehicle IDs against the ProcessInstance_Id.
View
The View is a Smart Object List View which is linked to SqlSo1. In the Edit Section, it has a picker control which is linked to SpSo1, and some DataLabel controls used to display selected vehicle specs. This View also contains the toolbar buttons i.e. Add, Edit, Delete Save, Refresh which execute their relevant functions using SqlSo1. The View also has a parameter called ProcessInstance_Id.
Working
When the view loads it should retrieve and load in the List Section (picker column) the list of all vehicle IDs from SqlSo1 saved against provided ProcessInstance_Id parameter. Simultaneously, against each vehicle ID loaded, it should also retrieve and load into the DataLabel columns the vehicle specifications from SpSo1 against each vehicle ID loaded.
The Edit Section in the View should allow to pick (in Picker control) and load (in DataLabel controls) vehicles using SpSo1 (which is achieved). Whereas the List Section should display data of vehicles retrieved from SqlSo1 such that Vehicle IDs retrieved from SqlSo1 and their other spec details retrieved from SpSo1 (Still to achieve and is the real question here).
Please help me in this regard. that would be so kind of you.
I have been finding difficulty resolving my issue that I raised here exactly a week ago but to the reality of this Forum I have not received even a single response from any of its gurus. and I have suffered at my work due to this.
I know I am quite new to K2 but you guys are gurus, you could have suggested at least something on my query.
Honestly, if StackOverflow is only to edit the posts and not suggest on the actual query then my suggestion to StackOverflow founders/CEOs is "SHUT IT DOWN".
Thank me.
to achieve that, you would need to add additional column to your view and to change it to List Display - where you would in turn change "Display" property of that control to show properties from SharePoint list.

Typo3 best practices - general variables

What is the best way to allow backend users to edit variables?
For example, I have a TYPO3 that sends out various e-Mail notifications and I want the backend users to be able to globally change the recipients. I started with template constants, until I found out, that backend users cannot edit the "template" module.
So what would be the best way to achieve this? I'm using Typo3 8.7.7
I would create a configuration record which can be edited by the backend users.
one way would be to include one file from fileadmin/ into the constants definition of typoscript. This file editors could change. But that could be a security risk, as the editors could define any constants.
the next option would be to define additional fields to the pages record, where these values could be set by any editor. In typoscript you access the field (maybe with slide = -1, so the value needs to be set just once)
another option: add these fields to a (special?) CE (ContentElement).
last option: use std CEs (e.g.HTML-content) at special pages or columns and use the content field (bodytext). (HTML-content has the advantage that the bodytext field is stored unmodified.)
Cleanest and leanest option would be option two (additional fields to table 'pages'). Option three and four are possible with pure typoscript, but you need to use CONTENT or RECORD object. If you use fix uids: remember that your editors might delete the CE and add a new CE with the same content (but another uid)
Addition:
As #Thomas-Löffler in his answer said:
you also can add a new kind of record/table, where an editor can insert or change the global values. Handling is like pages or tt_content. you can differ if your records are global (pid = 0, or special storage page) or dependent on page tree (rootpath), so you can have differnt values for different page subtrees.
I like Thomas‘ answer for providing a dedicated place to store the configuration option instead of putting it e.g. to pages because your configuration option is not bound to a page context.
Nonetheless for me personally it feels a bit odd to create a dedicated table for it. A table that would never hold more than one record.
That leads me to the conclusion that a key-value storage would be the right thing to use. Fortunately, TYPO3 ships System Registry. The only downside is that there‘s no interface for it so you‘d have to come up with your own forms to fill it. That‘s much easier if you go with Thomas‘ solution…
A clean and easy way is setting up a backend module with a form to set the email addresses.
Then you can grant the access right to a specific group or user and they are ready to go.

Is it possible to change the way a form loads with different data fields and values (Acces 2010)

I have Access 2010. I was wondering if there is a way to get the form to load different for every selection.
Example
Item A has 10 Rows and 6 columns of filled in data
Item B has 3 Rows and 2 Columns of filled in data
Both are from the same table.
Is there a way when a certain item is selected from a drop down menu to load, without having multiple forms, only the filled in data? Output would resemble Excel format.
Thank you in advance for any help.
Quick Answer (TL;DR)
Creating dynamically-generated form structure in MSFT Access can be done with sub-forms.
Detailed Answer
Context
MSFT Access
Creating forms
Problem
Scenario: Developer wishes to create context-specific form structure that depends on the query output.
Solution
Create one or more sub-form with attached VBA that changes dependent on the query ouput.
Connect the subform(s) to the primary form and load as needed depending on the context.
See also
https://stackoverflow.com/questions/tagged/ms-access+forms+vba
https://duckduckgo.com/?q=msft+access+dynamic+subform
How to dynamically load, access and unload subforms in microsoft access

Tableau: how to build cascading parameters?

Just see as following image
what I want to realize is, when I choose a specific area in the Area dropbox, The Block dropbox only shows the content which only belong to the selected area. How to realize that in tableau? Area and Block are both parameters.
I would advice you to use filter. then for the block filter,click the arrow on the top right and select "Only Relevant Values".The block filter will then refresh after you choose an area to show only the blocks related to that area.
For parameters currently the dynamic refresh feature is not present, though it is being demanded.
Filters can cascade in Tableau if you select the "Relevant Values" option on the quick filter. (see the little black triangle in the top right of the quick filter).
You may want to also put the two fields into a hierarchy to teach Tableau that Blocks are subordinate to Areas, but Tableau will try to show only relevant values even if you don't define the hierarchies explicitly. To make a hierarchy, drag fields on top of each other in the data pane on the left.
There is no concept of relevant values for parameters currently. Each has an independent range of values. Parameters are not tied to a data source.