Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
TammyPowlas
Active Contributor

Continuing on from A Quick Look at SAP Design Studio Extensions - no coding required I was interested in the Search Utilities box after seeing the demo here

http://visualbi.com/sap-design-studio/dsx-extensions/utilities/

I made several mistakes, which I will try to share here.

First, the search utility is only searching but not actually selecting the the item from the Listbox.  You also need to be careful if you are searching for the key or the text.  I know that sounds obvious but I made several mistakes in this area.

Figure 1

In the top right of Figure 1 I am searching for the key of a particular project.  I haven't selected it yet.

Figure 2

Figure 2 shows the actual selection of the project and the action that the listbox selects the project from the datasource.

Script for the startup event is below:

LISTBOX.setItems(DS_1.getMemberList("ZPROJ", MemberPresentation.INTERNAL_KEY, MemberDisplay.KEY, 50)

);

This fills the listbox.  Initially I had this set to text, but I was searching on key - this was not my only mistake, but it took a while to figure out what I was doing wrong.

Scripting on the Searchbox extension:

LISTBOX.removeAllItems();

var Search_Array=SEARCHBOX_1.DSXgetFirstDimension().split(";");

var Member_Array=DS_1.getMembers("ZPROJ", 50);

Search_Array.forEach(function(Search_Element, index) {

Member_Array.forEach(function(Member_Element, index) {

   if(Search_Element==Member_Element.internalKey)

   {

            LISTBOX.addItem(Member_Element.internalKey, Member_Element.internalKey);

   }

}

);

});

LISTBOX.setSelectedValue("");

It was here again I got the key and text mixed up; simply not being careful.  I also didn't have the last line in the code for a while either and it didn't work.

The above removes the items from the listbox and sets up the search.

Finally, code for the Listbox on select, which is like any other Listbox:

DS_1.setFilter("ZPROJ", LISTBOX.getSelectedValue());

Not thinking (again) I was using the setFilterExt

Another area to look at is the Edit > Initial View:

Figure 3

Initially, I had text when I was searching by key.  Of course, the search didn't work!

The search box is a handy utility if you want your dashboard consumers to find what they are looking for - where I work now, we have many projects.  One place I worked we had over 40K projects (yes, all in an SAP ERP system)

Reference:

Pre-Conference Seminars at SAPPHIRE NOW + ASUG Annual Conference Deep Dive includes hands-on with Design Studio - see more here


Labels in this area