Wednesday, June 22, 2011

How to update the Query fired in UI [this.GetSearchExpr();]

Req: I have to catch the Query before firing in UI .

Solution : this.GetSearchExpr(); In BC Server Script PreQuery

Code


function BusComp_PreQuery ()
{
/
try
{

var sSearchExpr;
var sActiveViewName;
sSearchExpr = this.GetSearchExpr();
//If u want to update query for a particular view
sActiveViewName = TheApplication().ActiveViewName();

//add the validation
if(TheApplication().GetProfileAttr("EEEE")>="Value"&& (sActiveViewName == "DSDS" || sActiveViewName == "XCDD" || sActiveViewName == "ZXXX"))
{
//SearchBuild Method is a custom method for creating Custom Query
var SearchString = SearchBuild();

if(sSearchExpr!="" && SearchString !="")
sSearchExpr += " AND (" + SearchString + ")";
else if (sSearchExpr!="" && SearchString =="")
sSearchExpr = sSearchExpr;
else
sSearchExpr = SearchString;

}

// If u need this Query in somewhere else put it in Profile attribute

this.SetSearchExpr(sSearchExpr);
this.ExecuteQuery(ForwardOnly);
}
catch (e)
{
var dbg = e.errText;
TheApplication().RaiseErrorText(e.errText);
}

return (ContinueOperation);
}


Note: GetSearchExpr returns the current search expression for the business component.

Returns
A string containing the current search expression. An example of a returned search expression string is "Revenue > 10000 AND Probability > .5".

Usage
GetSearchSpec retrieves the business component state, not the values. The business component state does not change until the query is executed. Note that it may never change to the original value if the user input is invalid.

When using GetSearchExpr in a browser script and the Applet_PreInvokeMethod, GetSearchExpr returns a null value even if a query filter has been added.

Used With
Browser Script, COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script

1 comment:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Siebel Business Automation, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Siebel Business Automation. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Nitesh Kumar
    MaxMunus
    E-mail: nitesh@maxmunus.com
    Skype id: nitesh_maxmunus
    Ph:(+91) 8553912023
    http://www.maxmunus.com/


    ReplyDelete