Showing posts with label OA Framework. Show all posts
Showing posts with label OA Framework. Show all posts

Wednesday, February 27, 2013

Using insertRow Vs insertRowAtRangeIndex

Using insertRow Vs insertRowAtRangeIndex

Scenario 1

    OAViewObjectImpl pervo = getDataVO1();
    if(!pervo.isPreparedForExecution())
         pervo.executeQuery();
     Row prow = pervo.createRow();
     prow.setAttribute("field",fieldvalue);
     pervo.insertRowAtRangeIndex(0,prow);
     prow.setNewRowState(Row.STATUS_INITIALIZED);

Scenario 2
    OAViewObjectImpl pervo = getDataVO1();
    if(!pervo.isPreparedForExecution())
         pervo.executeQuery();
     Row prow = pervo.createRow();
     prow.setAttribute("field",fieldvalue);
     pervo.last();
     pervo.next();
     pervo.insertRow(prow);
     prow.setNewRowState(Row.STATUS_INITIALIZED);


If you use the first method, it will add a row to the first record of the current page. Whereas if you use the second method it will add to last record of the last page

if you use pervo.insertRowAtRangeIndex(pervo.getRowCount-1,prow); it will work when there is 1 page only, if it goes to second page it will throw error

Monday, February 25, 2013

Difference Between getAllRowsInRange and getRowAtRangeIndex

We can retrieve the rows of an VO by 2 methods

Example 1
   oracle.jbo.Row rows[] = getdataVo.getAllRowsInRange();
 for (int i = 0; i < rows.Lengthi++)
{
   GetDataVORowImpl cafConfigVORow = (GetDataVORowImpl)rows(i);
}

Example 2
for (int i = 0; i < getDataVo.getRowCount(); i++)
{
    GetDataVORowImpl cafConfigVORow = (GetDataVORowImpl)getDataVo.getRowAtRangeIndex(i);
}


The difference betwen both is the first one will get records of first page only whereas the second example will retrieve all records.

Monday, October 01, 2012

How to give a link in Standard page to call custom OAF with custom parameters


I am personalizing opportunity page in sales module by adding a link to it. When the link id pressed, it should take to an custom OAF Page,

 i can do that by calling function or OA.jsp. I also need to pass the parameter of the existing opportunity page. the value which should be passed is in OAOPPDETAILVO1.LeadId

[VONAME.FieldName]

How to pass it.


Solution:

Go to the page you want to give link and add an item to it.


You will be seeing a screen like above. In the screen enter the VO name where the field value resides.
Then Leave the view attribute blank if you want to give speccific text. Give the specific text in Text.

in Destination URL give  the below
OA.jsp?page=/oracle/apps/msc/common/showoppdet/webui/oppDetPG&retainAM=N&addBreadCrumb=Y&oppId={@LeadId}

In the above the page oppDetPG is the custom page i have created. LeadId is column in OpportunityDetailsVO1

 
 
 



Tuesday, December 27, 2011

How to Download attachments from table using OAMessageDownloadBean

In OA Framework JDeveloper add a message Download Button 

Please Specify 
Data Type: BLOB
View Instance : DocumentsVO [Corresponding VO name]
View Attribute: FileName [File Name Column in the VO]
File View Attribute: FileData [Blob column containing the data]

Add the below lines in code to specify MIME Type
// OA Table
OATableBean tableBean =(OATableBean) webBean.findChildRecursive("AllDocumentsTable");
// message Download 
    OAMessageDownloadBean downloadBean = (OAMessageDownloadBean)tableBean.findChildRecursive("downloadFile");
    OADataBoundValueViewObject contentBoundValue = new OADataBoundValueViewObject(downloadBean,"FileContentType");
    downloadBean.setAttributeValue(FILE_CONTENT_TYPE, contentBoundValue);


Please note that there should be a primary column in the query. If there is no primary column all the rows will download a same file.

Wednesday, November 09, 2011

Error - You have encountered an unexpected error. Please contact the System Administrator for assistance.


We have to turn on diagnostics to see the error
Go to Application Developer --> Profiles -- System
Set FND: Diagnostics to Yes . This will display ther details link to show the full error where you can see the error

Thursday, March 31, 2011

How to display carriage return in oa framework web page table.

   I am having a column in a table which has carriage return chr(13) in the value. oracle will take care of this in forms by giving a line break. But OA Framework does not allow it.

I searched for many places in the net and couldnt find a solution. so i tried and found an alternative. Go to that column in the Region of type table and make the item style as raw text. While getting the code from VO object, change the column in the query to Replace(column_name,chr(13),'<br>')
If you have used chr(10) you can also replace it with


So when showing in table, there will be a line break for each chr(13)

Tuesday, February 22, 2011

How to check which LOV Event is pressed

I have many Lov in page and when a specific lov is getting selected, it should do some actions or call some dependent lov, Then below is the code to do so.

String lovInputSourceId = pageContext.getLovInputSourceId();

if (pageContext.isLovEvent())
{
if (lovInputSourceId.equals("CustomerSearch"))
{
Call AM Function

}
}

Monday, February 21, 2011

How to open a oracle form from OA Framework web page

The below is an example to open a form from oa web page

String destination = "form:CS:SIFY ENTERPRISE SUPPORT USER:STANDARD:CSXSRISR:open_flag=Y G_QUERY_FIND='FALSE'";
pageContext.forwardImmediatelyToForm(destination);

where the below represents what to give where
"form:APPLICATION_SHORT_NAME:RESPONSIBILITY:STANDARD:FORM NAME:PARAMETERS";

Thursday, January 20, 2011

Advanced Search Bean to get Criteria and Load based on it OA Framework

Controller Code

public void SetQuery(OAPageContext pageContext, OAWebBean webBean)
{
AllianceTeamAMImpl MyRequestAm =(AllianceTeamAMImpl) pageContext.getApplicationModule(webBean);
OAQueryBean queryBean =(OAQueryBean)webBean.findIndexedChildRecursive("SearchRn");
Dictionary[] dic = queryBean.getCriteria(pageContext);
// If the dictionary is empty, then it means that no non-view criteria
// is available, so return.
if(pageContext.getParameter(queryBean.getGoButtonName()) != null )
{
// When Button is pressed it will go in below loop
if (dic != null && !dic.toString().equals(""))
{
// Otherwise process the dictionary to build your where clause.
Hashtable params = new Hashtable();
int size = dic.length;
int clauseCount = 0;
int bindCount = 2;
StringBuffer whereClause = new StringBuffer();
Vector parameters = new Vector();
ViewObject allTeamVO = MyRequestAm.findViewObject("MyAllianceTeamVO2");

// Iterate through the dictionary to set your where clauses
for (int i=0; i < size; i++) { // Item for which the criteria is defined. String itemName = (String) dic[i].get(OAViewObject.CRITERIA_ITEM_NAME); String viewAttributename = (String)dic[i].get(OAViewObject.CRITERIA_VIEW_ATTRIBUTE_NAME); String columnName = allTeamVO.findAttributeDef(viewAttributename).getColumnNameForQuery(); // Condition is the SQL condition - examples: like , = etc String condition = (String) dic[i].get(OAViewObject.CRITERIA_CONDITION); // String criteriaDataType = (String)dic[i].get(OAViewObject.CRITERIA_DATATYPE); // Value is the value entered with the appropriate % based on condition Object value = dic[i].get(OAViewObject.CRITERIA_VALUE); // Join condition is either AND or OR depending on what user chooses String joinCondition = (String) dic[i].get(OAViewObject.CRITERIA_JOIN_CONDITION); if(value != null) { if(clauseCount > 0)
{
whereClause.append(" AND ");
}
whereClause.append(columnName + " " + condition + " :");
whereClause.append(++bindCount);
parameters.addElement(value);
clauseCount++;
}
}
// If where clause and criteria then get query
if(dic != null && whereClause != null)
{
MyRequestAm.initMyAllianceTeamUserVOQuery("" +pageContext.getUserId(), pageContext.getTransactionTransientValue("Team").toString(),whereClause.toString(),parameters);
}
}
// When Criteria is null Bring all
else
{
MyRequestAm.initMyAllianceTeamUserVOQuery("" +pageContext.getUserId(), pageContext.getTransactionTransientValue("Team").toString());
}
}
}



AM Code
public void initMyAllianceTeamUserVOQuery(String user,String team,String WhereClause, Vector parameters)
  {
    MyAllianceTeamVOImpl vo=  getMyAllianceTeamVO2();
    if(vo==null)
    {
      MessageToken[] errTokens = {new MessageToken("OBJECT_NAME", "MyAllianceTeamVO")};
      throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
    }

    vo.setWhereClauseParams(null);
    vo.setWhereClauseParam(0,user);
    if(team.equals("AllianceTeam"))
    {
       vo.setWhereClauseParam(1,"1");
    }
    else
    {
      vo.setWhereClauseParam(1,"2");
    }
  
    if(WhereClause != null)
    {
      vo.setWhereClause(WhereClause);
      int cnt = parameters.size();
      for(int i=0;i
      {
         vo.setWhereClauseParam(i+2,parameters.get(i));
      }
    }
    vo.executeQuery();
    vo.setWhereClause(null);
  }
Controller code
1. We are taking the region of Search and getting its QueryBean
2. Next we are checking whether button is pressed.
3. we are getting the search criteria selected by user and assin it to dictionary
4. We are looping through Dictionary and create where clause and parameters and send it to AM to execute based on search clause given
5. If i dont pass any parameters , then by default all is loaded.
6. I have set bindcount to 2 because i have already 2 parameters

Model Code

1. We are getting the parameters and adding the parameters to the view object and execute it.

How to get bean value in Advanced Search OA Framework

In Advanced search the criteria is stored in order of Value_0,Value_1,...

I want to set a oaMessageChoice bean value in page load(processRequest)

My code will be.

OAAdvancedSearchBean advBean = (OAAdvancedSearchBean)webBean.findChildRecursive("advancedSearch");
OAMessageChoiceBean StatusSearch = (OAMessageChoiceBean)advBean.findChildRecursive("Value_1");
StatusSearch.setValue(pageContext,"Pending with Alliance");

where

advanced search is the ID of AdvancedSearch Region