cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in search the values in ValueHelp.

vijay_kumar49
Active Contributor
0 Kudos

Hello Friends,

I have issue in search the data from the ValueHelp as per below code. when i click on Search in network tab its showing "$skip=0&$top=20" due to this it displayed 20 values. Instead of  20 how to pass "1" into the Service URL.


salesGrpValueHelp: function(oEvent) {

            var oSalesGroupEntitySet = "";

            var oSalesGroupItemTemplate = new sap.m.StandardListItem({

                title: "{Vkgrp}",

                description: "{Bezei}",

                info: "{Vkbur}",

                active: true

            });

//Creation of the JSON Model for the Test Daa

            var oSalesGroupModel = this.getView().getModel("QuoteModel");

            //Create the Dialog and we attach this as helper

            var oSalesGroupSelectDialog = new sap.m.SelectDialog({

                title: "Select Sales Group Values",

                noDataText: "No Sales Group Values Found",

                search: this._oSalesGroupValueHelpSearch,

                confirm: function(oevt) {

                    this._oSalesGroupValueHelpClose(oevt);

                }.bind(this),

                cancel: this._oSalesGroupValueHelpClose

            });

//Now set the model for Dialog and bind the Aggregration.

            if (vsalesOfficeValue === "") {              

                oSalesGroupEntitySet = "/HTvbvkSet?$filter=Vkgrp gt '010'";

            } else if (vsalesOfficeValue !== null) {              

                oSalesGroupEntitySet = "/HTvbvkSet?$filter=Vkbur eq ('" + vsalesOfficeValue + "') and Vkgrp gt ('" + VkgrpNum + "')";

            }

            oSalesGroupSelectDialog.setModel(oSalesGroupModel);

            oSalesGroupSelectDialog.bindAggregation("items", oSalesGroupEntitySet, oSalesGroupItemTemplate);

            oSalesGroupSelectDialog.open();

        },

_oSalesGroupValueHelpClose: function(evt) {

            var oSelectedItem = evt.getParameter("selectedItem");

            var productInput = this.getView().byId("VKGRP_id");

            productInput.setValue(oSelectedItem.getTitle());

            evt.getSource().getBinding("items").filter([]);

            this.onSelectInputValidation();          

            vsalesOfficeValue = "";

        },

        _oSalesGroupValueHelpSearch: function(evt) {

            //var sValue = evt.getParameter("value");

            var sValue = "'" + evt.getParameter("value") + "'";

            var oFilter = new Filter(

                "Vkgrp",

                sap.ui.model.FilterOperator.Contains, sValue

            );

            evt.getSource().getBinding("items").filter([oFilter]);

            vsalesOfficeValue = "";

        }

using below URL. It displayed 20 records

https://HOST/sap/opu/odata/sap/zgw_create_quotation_srv/HTvbvkSet?$skip=0&$top=20&$filter=substringo...

using below URL. It displayed 1 records

https://HOST/sap/opu/odata/sap/zgw_create_quotation_srv/HTvbvkSet?$skip=0&$top=1&$filter=substringof...

Kindly help me on this issue.

Regards

Vijay

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vijay,

Please check the back-end service, for me it seems to be service issue.

Request you to check the front-end url in gateway client and check if the result same.

Thanks,

Jay

Former Member
0 Kudos

Hi Vijay,

Could you test the filter service.

There is a possibility to handle this from service.

Ideally it should give you one record when you search for one value.

Could you tell me how this filter made and what is the structure for select statement.

Thanks,

Jay

junwu
Active Contributor
0 Kudos

Ideally it should give you one record when you search for one value?

what's the logic?????

SergioG_TX
Active Contributor
0 Kudos

Vijjay, this is because you are using the Contains Filter Operator.

if you want to minimize the numeber of records, you could use the EQ Filter Operator, or... alternatively, you could add a   &$top=1  flag on the URL you are querying in order to retrieve only the top 1 record from the result set. this is just standard odata query syntax.

i hope this is helpful

vijay_kumar49
Active Contributor
0 Kudos

Thanks for Quick Reply


alternatively, you could add a   &$top=1  flag on the URL

How to add "&stop=1" in UI5 appliaction?

Regards

Vijaty

junwu
Active Contributor
0 Kudos

YOURMODEL.setSizeLimit(999)

vijay_kumar49
Active Contributor
0 Kudos

You mean,

is it right

  var oSalesGroupModel = this.getView().getModel("QuoteModel").setSizeLimit(999);

Former Member
0 Kudos

Hi Vijay,

Your need to add $top similar to $filter in  your code above:

oSalesGroupEntitySet = "/HTvbvkSet?$filter=Vkgrp gt '010'&$top=1"

thanks,

viplove

junwu
Active Contributor
0 Kudos

try, you will know, 

vijay_kumar49
Active Contributor
0 Kudos

Using your code when i click on ValueHelp then only its comming only one value.

I need when we click on Search

vijay_kumar49
Active Contributor
0 Kudos

not working JunWu

vijay_kumar49
Active Contributor
0 Kudos

How to add  "&$top=1"" in UI5 appliaction? Can you pls. help me

junwu
Active Contributor
0 Kudos

set it, before making the odata call

your code please

vijay_kumar49
Active Contributor
0 Kudos

As per the above requirement i made changes as per below code. I need to display the sales-group values depending upon sales-office if select sales-office. If not select the sales-office i am displaying total values from the sales-group as per below code.


salesGrpValueHelp: function(oEvent) {  

          

            var oSalesGroupEntitySet = "";

            vsalesOfficeValue=this.getView().byId("VKBUR_id").getValue();

        //    this.inputId = oEvent.getSource().getId();

            var oSalesGroupItemTemplate = new sap.m.StandardListItem({

                title: "{Vkgrp}",

                description: "{Bezei}",

                info: "{Vkbur}",

                active: true

            });

             //Creation of the JSON Model for the Test Daa

            var oSalesGroupModel = this.getView().getModel("QuoteModel");

            //oSalesGroupModel.setSizeLimit(1);

          

            //Create the Dialog and we attach this as helper

            var oSalesGroupSelectDialog = new sap.m.SelectDialog({

                title: "Select Sales Group Values",

                noDataText: "No Sales Group Values Found",

                search: this._oSalesGroupValueHelpSearch,

                confirm: function(oevt) {

                    this._oSalesGroupValueHelpClose(oevt);

                }.bind(this),

                cancel: this._oSalesGroupValueHelpClose

            });

            this.getView().addDependent(oSalesGroupSelectDialog);

          

            //Now set the model for Dialog and bind the Aggregration.

             var filtersArray=[];

          

            if (vsalesOfficeValue !== null) {

                var vsalesOfficeValueFilter = new sap.ui.model.Filter("Vkbur", sap.ui.model.FilterOperator.EQ, vsalesOfficeValue);      

                filtersArray.push(vsalesOfficeValueFilter);

            }

            oSalesGroupSelectDialog.setModel(oSalesGroupModel);      

            oSalesGroupSelectDialog.bindAggregation("items", "/HTvbvkSet", oSalesGroupItemTemplate);

            oSalesGroupSelectDialog.getBinding("items").filter(filtersArray);

            oSalesGroupSelectDialog.open();

        }

when i click on sales- group its showing few values only. Its not coming total values as per below screen shot.

Here

$count is comming 24 values

$skip=0&$top=20 : here through error in service URL and displaying few values as per above screen shot.


if i remove "$skip=0&$top=20" from the URL in Browser its coming  total values in Browser. how to remove/restrict the $skip=0&$top=20 from UI5 side this issue and How to display total values in Value Help. Kindly help me


Regards

Vijay


junwu
Active Contributor
0 Kudos

man, where is the setSizeLimit