cancel
Showing results for 
Search instead for 
Did you mean: 

Display data according to Business Group

Former Member
0 Kudos

Hi Experts,

I have a scenario where I have to display data According to Business Group. Each business group have a number of sites and each site fill data in a form. When the user selects the Business Group, all site wise data should be displayed in the form designed. Gurus what will be code to display and my code is below:

// ---------------------------------------------------------------------------

// This file has been generated partially by the Web Dynpro Code Generator.

// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.

// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.

// ---------------------------------------------------------------------------

package com.lanco;

//

// IMPORTANT NOTE:

// _ALL_ IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED

// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN

// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateZcumulative_displayView).

// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY

// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS

// OF IMPORT STATEMENTS.

//

//@@begin imports

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.Statement;

import com.lanco.wdp.IPrivateZcumulative_displayView;

import com.sap.tc.webdynpro.progmodel.api.WDVisibility;

//@@end

//@@begin documentation

//@@end

public class Zcumulative_displayView

{

  /**

   * Logging location.

   */

  private static final com.sap.tc.logging.Location logger =

    com.sap.tc.logging.Location.getLocation(Zcumulative_displayView.class);

  static

  {

    //@@begin id

  String id = "$Id$";

    //@@end

    com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);

  }

  /**

   * Private access to the generated Web Dynpro counterpart

   * for this controller class.  </p>

   *

   * Use <code>wdThis</code> to gain typed access to the context,

   * to trigger navigation via outbound plugs, to get and enable/disable

   * actions, fire declared events, and access used controllers and/or

   * component usages.

   *

   * @see com.lanco.wdp.IPrivateZcumulative_displayView for more details

   */

  private final IPrivateZcumulative_displayView wdThis;

  /**

   * Root node of this controller's context. </p>

   *

   * Provides typed access not only to the elements of the root node

   * but also to all nodes in the context (methods node<i>XYZ</i>())

   * and their currently selected element (methods current<i>XYZ</i>Element()).

   * It also facilitates the creation of new elements for all nodes

   * (methods create<i>XYZ</i>Element()). </p>

   *

   * @see com.lanco.wdp.IPrivateZcumulative_displayView.IContextNode for more details.

   */

  private final IPrivateZcumulative_displayView.IContextNode wdContext;

  /**

   * A shortcut for <code>wdThis.wdGetAPI()</code>. </p>

   *

   * Represents the generic API of the generic Web Dynpro counterpart

   * for this controller. </p>

   */

  private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;

 

  /**

   * A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>

   *

   * Represents the generic API of the Web Dynpro component this controller

   * belongs to. Can be used to access the message manager, the window manager,

   * to add/remove event handlers and so on. </p>

   */

  private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;

 

  public Zcumulative_displayView(IPrivateZcumulative_displayView wdThis)

  {

    this.wdThis = wdThis;

    this.wdContext = wdThis.wdGetContext();

    this.wdControllerAPI = wdThis.wdGetAPI();

    this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

  }

  //@@begin javadoc:wdDoInit()

  /** Hook method called to initialize controller. */

  //@@end

  public void wdDoInit()

  {

    //@@begin wdDoInit()

  //wdContext.currentContextElement().setVa_epc(WDVisibility.NONE);

    //@@end

  }

  //@@begin javadoc:wdDoExit()

  /** Hook method called to clean up controller. */

  //@@end

  public void wdDoExit()

  {

    //@@begin wdDoExit()

    //@@end

  }

  //@@begin javadoc:wdDoModifyView

  /**

   * Hook method called to modify a view just before rendering.

   * This method conceptually belongs to the view itself, not to the

   * controller (cf. MVC pattern).

   * It is made static to discourage a way of programming that

   * routinely stores references to UI elements in instance fields

   * for access by the view controller's event handlers, and so on.

   * The Web Dynpro programming model recommends that UI elements can

   * only be accessed by code executed within the call to this hook method.

   *

   * @param wdThis Generated private interface of the view's controller, as

   *        provided by Web Dynpro. Provides access to the view controller's

   *        outgoing controller usages, etc.

   * @param wdContext Generated interface of the view's context, as provided

   *        by Web Dynpro. Provides access to the view's data.

   * @param view The view's generic API, as provided by Web Dynpro.

   *        Provides access to UI elements.

   * @param firstTime Indicates whether the hook is called for the first time

   *        during the lifetime of the view.

   */

  //@@end

  public static void wdDoModifyView(IPrivateZcumulative_displayView wdThis, IPrivateZcumulative_displayView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

  {

    //@@begin wdDoModifyView

    //@@end

  }

  //@@begin javadoc:database()

  /** Declared method. */

  //@@end

  public void database( )

  {

    //@@begin database()

  try{

  //data base connection statements, organise importa, jar files in navigator

   Class.forName("oracle.jdbc.driver.OracleDriver");

   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

   conn = DriverManager.getConnection(connectiontext,user,pwd);

   Statement stmt=conn.createStatement();

   sql1=conn.createStatement();

   sql2=conn.createStatement();

    // getresult();

    }

   catch (Exception e) {

    // TODO: handle exception

  wdComponentAPI.getMessageManager().reportException("Error in database Method",true);

  wdComponentAPI.getMessageManager().reportException(e.toString(),false);

  }

    //@@end

  }

  //@@begin javadoc:onActiondisplay(ServerEvent)

  /** Declared validating event handler. */

  //@@end

  public void onActiondisplay(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

  {

    //@@begin onActiondisplay(ServerEvent)

   

  IPrivateZcumulative_displayView.IContextElement ele = wdContext.currentContextElement();

   

  wdContext.nodeKey().invalidate();

  wdContext.nodeManhour().invalidate();

  wdContext.nodeIncidence().invalidate();

  wdContext.nodeLost_time().invalidate();

  wdContext.nodeLegal().invalidate();

  wdContext.nodeTrainings().invalidate();

  wdContext.nodeInspection().invalidate();

  wdContext.nodeOccupation().invalidate();

  wdContext.nodeEmergency().invalidate();

  wdContext.nodeEnvironment().invalidate();

  wdContext.nodeContract().invalidate();

  IPrivateZcumulative_displayView.IKeyElement key = wdContext.currentKeyElement();

  IPrivateZcumulative_displayView.IManhourElement man = wdContext.currentManhourElement();

  IPrivateZcumulative_displayView.IIncidenceElement inc = wdContext.currentIncidenceElement();

  IPrivateZcumulative_displayView.ILost_timeElement los = wdContext.currentLost_timeElement();

  IPrivateZcumulative_displayView.ILegalElement leg = wdContext.currentLegalElement();

  IPrivateZcumulative_displayView.ITrainingsElement tra = wdContext.currentTrainingsElement();

  IPrivateZcumulative_displayView.IInspectionElement ins = wdContext.currentInspectionElement();

  IPrivateZcumulative_displayView.IOccupationElement occ = wdContext.currentOccupationElement();

  IPrivateZcumulative_displayView.IEmergencyElement eme = wdContext.currentEmergencyElement();

  IPrivateZcumulative_displayView.IEnvironmentElement env = wdContext.currentEnvironmentElement();

  IPrivateZcumulative_displayView.IContractElement con = wdContext.currentContractElement();

  String Queryselect = null;

  String month=ele.getMonth();

  //int prevmonth =1;

  //int months =Integer.parseInt(month)- prevmonth;

  String year= ele.getYear();

  String bgroup =ele.getBusiness_group();

  String vertical =ele.getBusiness_vertical();

  String pvertical =ele.getProject_vertical();

  String site=ele.getSite();

  try

  {

  Connection conn=null;

  Statement sqlstat=null;

  //data base connection statements, organise importa, jar files in navigator

  Class.forName("oracle.jdbc.driver.OracleDriver");

  DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

  conn =DriverManager.getConnection(connectiontext,user,pwd);

  Statement stmt=conn.createStatement();

  sqlstat=conn.createStatement();

  String queryselect3=null;

  try{

  queryselect3="select sum(manhour1),sum(manhour2),sum(mh_total), sum(ip_emp1),sum(ip_emp2),sum(ip_emp3),sum(ip_emp4),sum(ip_con1),sum(ip_con2),sum(ip_con3),sum(ip_con4),sum(lti_total),sum(ip_fy2),sum(ip_totalcost),sum(Fr),sum(Sr), sum(ht_train_mth),sum(ht_manhrs_mth), sum(ht_toolbox_mth),sum(ht_hours_mth) from hsemonthly_report1 where  bgroup='"+bgroup+"' and site='"+site+"' and months <='"+month+"'  and years='"+year+"'";

  //wdComponentAPI.getMessageManager().reportSuccess("select sum(mh_emp),sum(mh_con) from hsemonthly_report1 where bgroup='"+group+"' and bvertical='"+vertical+"' and pvertical='"+pvertical+"' and site='"+site+"' and months >='"+months+"' and years='"+year+"'");

  ResultSet RST=stmt.executeQuery(queryselect3);

  //check wheteher the values are already exist

  int count=0;

  //wdComponentAPI.getMessageManager().reportSuccess(String.valueOf(count));

  while (RST.next())

  {

  count=1;

  man.setEmp_yr(RST.getInt(1));

  man.setCon_yr(RST.getInt(2));

  man.setTotal_yr(RST.getInt(3));

  inc.setEmp_fatal_yr(RST.getInt(4));

  inc.setEmp_record_yr(RST.getInt(5));

  inc.setEmp_first_yr(RST.getInt(6));

  inc.setEmp_near_yr(RST.getInt(7));

  inc.setCom_fatal_yr(RST.getInt(8));

  inc.setCon_record_yr(RST.getInt(9));

  inc.setCon_first_yr(RST.getInt(10));

  inc.setCon_near_yr(RST.getInt(11));

  los.setLtc_yr(RST.getInt(12));

  los.setMdl_yr(RST.getInt(13));

  los.setCost_yr(RST.getInt(14));

  los.setFr_yr(RST.getInt(15));

  los.setSr_yr(RST.getInt(16));

  tra.setTrain_yr(RST.getInt(17));

  tra.setManhours_yr(RST.getInt(18));

  tra.setTrained_yr(RST.getInt(19));

  tra.setInducted_yr(RST.getInt(20));

  }

  //lost.setFr_emp((lost.getLtc_emp()/man.getMh_total())*100000);

  

  if (count==1)

  {

  wdComponentAPI.getMessageManager().reportSuccess("Success"); 

  }

  else{

  //wdComponentAPI.getMessageManager().reportException("No Values Exists for the Previous Month",false);

  }

  }catch(Exception e){

  wdComponentAPI.getMessageManager().reportException("Values not Retriving for yearly table1 exception",false);

  wdComponentAPI.getMessageManager().reportException(e.toString(),false);

  }

  try{

  String queryselect4=null;

  queryselect4="select sum(IA_INSPECTIONS_MO), sum(IA_AUDITS_MO), sum(ia_stake_mo), sum(ia_other_mo), sum(ia_extagencies), sum(ia_obs_closed_mo), sum(ia_obs_open_mo), sum(ia_HSEsteering), sum(oh_examination), sum(oh_health), sum(env_energy), sum(env_fuels), sum(env_consumed), sum(env_nonhazadous), sum(env_hazardous), sum(env_release), sum(env_spillage) from hsemonthly_report2 where  bgroup='"+bgroup+"' and site='"+site+"' and months <='"+month+"'  and years='"+year+"'";

  //wdComponentAPI.getMessageManager().reportSuccess("select sum(ia_inspections_mo),sum(ia_audits_mo),sum(ia_obs_closed_mo),sum(ia_obs_open_mo),sum(ia_stake_mo),sum(ia_other_mo),sum(wps_mo),sum(per_review),sum(per_drawings),sum(per_hazops),sum(per_jsas),sum(per_risk),sum(ppe_ppe_mo),sum(ppe_compliance_mo),sum(env_energy),sum(env_fuels),sum(env_consumed),sum(env_nonhazadous),sum(env_hazardous),sum(env_release),sum(env_spillage),sum(env_programmes),sum(env_other),sum(oh_examination),sum(oh_health),sum(oh_other),sum(erp_extinguishers),sum(erp_hydrant),sum(erp_firstaid),sum(erp_safety),sum(erp_spillkit),sum(erp_mockdrills),sum(erp_key),sum(cis_incident),sum(cis_investigation),sum(cis_manual),sum(cis_housekeeping),sum(cis_contractor),sum(cis_steering) from hsemonthly_report2 where bgroup='"+group+"' and bvertical='"+vertical+"' and pvertical='"+pvertical+"' and site='"+site+"' and months <='"+month+"'  and years='"+year+"'");

  ResultSet RS=sqlstat.executeQuery(queryselect4);

  //check wheteher the values are already exist

  int count=0;

  //wdComponentAPI.getMessageManager().reportSuccess(String.valueOf(RS.next()));

    while (RS.next())

  {

    count=1;

    ins.setSite_yr(RS.getInt(1));

    ins.setHouse_yr(RS.getInt(2));

    ins.setLayer1_yr(RS.getInt(3));

    ins.setLayer2_yr(RS.getInt(4));

    ins.setLayer3_yr(RS.getInt(5));

    ins.setLayer3_total_fy(RS.getInt(6));

    ins.setLayer3_closed_fy(RS.getInt(7));

    ins.setSteering_yr(RS.getInt(8));

    occ.setExam_yr(RS.getInt(9));

    occ.setHealth_yr(RS.getInt(10));

    env.setEnergy_yr(RS.getInt(11));

    env.setFuel_yr(RS.getInt(12));

    env.setWater_yr(RS.getInt(13));

    env.setNonhazardous_yr(RS.getInt(14));

    env.setHazardous_yr(RS.getInt(15));

    env.setRelease_yr(RS.getInt(16));

    env.setSpill_yr(RS.getInt(17));

//   con.setCondition_yr(RS.getInt(18));

//   con.setPer_yr(RS.getInt(19));

  //wdComponentAPI.getMessageManager().reportSuccess(group);

  }

  if (count==0)

    {

    wdComponentAPI.getMessageManager().reportException("No Values Exists for the Previous Month",false); 

    }

  }catch(Exception ex){

  // wdComponentAPI.getMessageManager().reportException("Values not Retriving for YTD2",false);

  wdComponentAPI.getMessageManager().reportException(ex.toString(),false);

  }

  }

  catch (Exception ex) {

  // TODO: handle exception

  wdComponentAPI.getMessageManager().reportException("Error in form db Method",true);

  wdComponentAPI.getMessageManager().reportException(ex.toString(),false);

  }

  try{

  //lost.setFr_emp((lost.getLtc_emp()/man.getMh_emp())*1000000);

  //wdContext.nodeAmarkantak().invalidate();

  //wdContext.nodeAnpara().invalidate();

  //wdContext.nodeUdipi().invalidate();

    database();

   

    Statement stmt=conn.createStatement();

   

    Queryselect="select KEY1, KEY2, KEY3, KEY4, KEY5, MANHOUR1, MANHOUR2, MH_TOTAL, IP_EMP1, IP_EMP2, IP_EMP3, IP_EMP4, IP_CON1, IP_CON2, IP_CON3, IP_CON4, INCIDENCE_PERFORMANCE1, LTI_CONTRACTOR, LTI_TOTAL, INCIDENCE_PERFORMANCE2, MDL_TOTAL,IP_FY2, IP_TOTALCOST, FR_EMP, FR_CON, FR, SR_EMP, SR_CON, SR, CAPA_CLOSED, COMMENT1, LC_GOVT_MO, LC_GOVT_CO, LC_PENALTIES_MO, LC_PENALTIES_CO, LC_CAUSE_MO, LC_CAUSE_CO, LEG_PUBLIC, LC_OTHER_CO, HT_TRAIN_MTH, HT_MANHRS_MTH, HT_TOOLBOX_MTH, HT_HOURS_MTH from HSEMONTHLY_REPORT1 where  bgroup='"+bgroup+"' and site='"+site+"' and months='"+month+"'  and years='"+year+"'";

    //wdComponentAPI.getMessageManager().reportSuccess(Queryselect);

  // wdComponentAPI.getMessageManager().reportException(Queryselect1,true);

  ResultSet RST= stmt.executeQuery(Queryselect);

  int count=0;

  while(RST.next())

  {

  count=1;

  //wdComponentAPI.getMessageManager().reportSuccess("going inside");

  //cont.setRemarks(RST.getString(1));

  key.setKey1(RST.getString(1));

  key.setKey2(RST.getString(2));

  key.setKey3(RST.getString(3));

  key.setKey4(RST.getString(4));

  key.setKey5(RST.getString(5));

  man.setEmp_m(RST.getInt(6));

  man.setCon_m(RST.getInt(7));

  man.setTotal_m(RST.getInt(8));

  inc.setEmp_fatal_m(RST.getInt(9));

  inc.setEmp_record_m(RST.getInt(10));

  inc.setEmp_first_m(RST.getInt(11));

  inc.setEmp_near_m(RST.getInt(12));

  inc.setCon_fatal_m(RST.getInt(13));

  inc.setCon_record_m(RST.getInt(14));

  inc.setCon_first_m(RST.getInt(15));

  inc.setCon_near_m(RST.getInt(16));

  los.setLtc_emp(RST.getFloat(17));

  los.setLtc_con(RST.getFloat(18));

  los.setLtc_total(RST.getInt(19));

  los.setMdl_emp(RST.getFloat(20));

  los.setMdl_con(RST.getFloat(21));

  los.setMdl_total(RST.getFloat(22));

  los.setCost_emp(RST.getInt(23));

  los.setFr_emp(RST.getFloat(24));

  los.setFr_con(RST.getFloat(25));

  los.setFr_total(RST.getFloat(26));

  los.setSr_emp(RST.getFloat(27));

  los.setSr_con(RST.getFloat(28));

  los.setSr_total(RST.getFloat(29));

  los.setCapa_closed(RST.getInt(30));

  los.setCapa_comment(RST.getString(31));

  leg.setGov(RST.getInt(32));

  leg.setGov_com(RST.getString(33));

  leg.setFine(RST.getInt(34));

  leg.setFine_com(RST.getString(35));

  leg.setShow(RST.getInt(36));

  leg.setShow_com(RST.getString(37));

  leg.setOther(RST.getString(38));

  leg.setOther_com(RST.getString(39));

  tra.setTrain_m(RST.getInt(40));

  tra.setManhours_m(RST.getInt(41));

  tra.setTrain_m(RST.getInt(42));

  tra.setInducted_m(RST.getInt(43));

  if (los.getFr_emp()==00.00)

  {

  man.setTotal_m(man.getEmp_m()+man.getCon_m());

  man.setTotal_yr(man.getEmp_yr()+man.getCon_yr());

  los.setFr_emp((los.getLtc_emp()/man.getTotal_m())*1000000);

  los.setFr_con((los.getLtc_con()/man.getTotal_m())*1000000);

  los.setFr_total(los.getFr_emp()+los.getFr_con());

  los.setSr_emp((los.getMdl_emp()/man.getTotal_m())*1000000);

  los.setSr_con((los.getMdl_con()/man.getTotal_m())*1000000);

  los.setSr_total(los.getSr_emp()+los.getSr_con());

  //los.setFr_fy((los.getLtc_yr()/man.getTotal_yr())*1000000);

  //los.setSr_fy((los.getMdl_yr()/man.getTotal_yr())*1000000);

  }

  else

  {

  wdComponentAPI.getMessageManager().raiseException("No values exists for the selected date",true);

  }

  //wdComponentAPI.getMessageManager().reportSuccess(site);

  }

  if(count ==1)

  {

  wdContext.currentContextElement().setVa_epc(WDVisibility.VISIBLE);

  }

  else

  {

  wdComponentAPI.getMessageManager().raiseException("No values exists for the selected date",true);

  }

  }

  catch(Exception e)

  {

  wdComponentAPI.getMessageManager().raiseException(e.toString(),true);

  //wdContext.currentContextElement().setVa_EPC(WDVisibility.VISIBLE);

// wdContext.currentContextElement().setVa_visible_amrk(WDVisibility.NONE);

// wdContext.currentContextElement().setVa_visible_anpara(WDVisibility.NONE);

// wdContext.currentContextElement().setVa_visible_udipi(WDVisibility.NONE);

  }

  try

  {

  database();

  Statement sql1=conn.createStatement();

  String queryselect1=null;

  queryselect1="select ia_inspections_mo, ia_audits_mo, ia_layer1, ia_stake_mo, ia_other_mo, ia_ex_agencies, ia_obs_closed_mo, ia_obs_open_mo, ia_HSEsteering, ia_inspections_co, ia_audits_co, ia_layer_co, ia_stake_co, ia_other_co, ia_extagencies_co, ia_obs_co,  ia_HSEsteering_co, oh_examination, oh_health, oh_other, eme_plan, eme_year1, eme_year2, erp_hydrant, env_energy, env_fuels, env_consumed, env_nonhazadous, env_hazardous, env_release, env_spillage, env_programmes, env_other, con_m, per_m, Anyother from hsemonthly_report2 where bgroup='"+bgroup+"' and site='"+site+"' and months='"+month+"'  and years='"+year+"'";

  //wdComponentAPI.getMessageManager().reportSuccess(queryselect1);

    ResultSet RS=sql1.executeQuery(queryselect1);

   //check wheteher the values are already exist

  int count=0;

  while(RS.next())

  {

  count=1;

  //wdComponentAPI.getMessageManager().reportSuccess("going inside");

  //cont.setRemarks(RST.getString(1));

  ins.setSite_m(RS.getInt(1));

  ins.setHouse_m(RS.getInt(2));

  ins.setLayer1_m(RS.getInt(3));

  ins.setLayer2_m(RS.getInt(4));

  ins.setLayer3_m(RS.getInt(5));

  ins.setExternal_m(RS.getInt(6));

  ins.setLayer3_total_m(RS.getInt(7));

  ins.setLayer3_closed_m(RS.getInt(8));

  ins.setSteering_m(RS.getInt(9));

  ins.setSite_com(RS.getString(10));

  ins.setHouse_com(RS.getString(11));

  ins.setLayer1_com(RS.getString(12));

  ins.setLayer2_com(RS.getString(13));

  ins.setLayer3_com(RS.getString(14));

  ins.setExternal_com(RS.getString(15));

  ins.setLayer3_comm(RS.getString(16));

  ins.setSteering_com(RS.getString(17));

  occ.setExam_m(RS.getInt(18));

  occ.setHealth_m(RS.getInt(19));

  occ.setAnother_m(RS.getString(20));

  eme.setPlan_m(RS.getString(21));

  eme.setPlan_com(RS.getString(22));

  eme.setDrill_m(RS.getInt(23));

  eme.setDrill_com(RS.getString(24));

  env.setEnergy_m(RS.getInt(25));

  env.setFuel_m(RS.getInt(26));

  env.setWater_m(RS.getInt(27));

  env.setNonhazardous_m(RS.getInt(28));

  env.setHazrdous_m(RS.getInt(29));

  env.setRelease_m(RS.getInt(30));

  env.setSpill_m(RS.getInt(31));

  env.setProg_m(RS.getString(32));

  env.setOther_m(RS.getString(33));

  con.setCon_m(RS.getInt(34));

  con.setPer_m(RS.getInt(35));

  ele.setAnyother(RS.getString(36));

  //wdComponentAPI.getMessageManager().reportSuccess(site);

  }

  if(count ==1)

  {

  wdContext.currentContextElement().setVa_epc(WDVisibility.VISIBLE);

  //wdComponentAPI.getMessageManager().reportSuccess("Insert Zero in case of Null or No value");

  }

  else

  {

  wdComponentAPI.getMessageManager().raiseException("No values exists for the selected date",true);

  }

  }

  catch(Exception e)

  {

  wdComponentAPI.getMessageManager().raiseException(e.toString(),true);

  }

    //@@end

  }

  /*

   * The following code section can be used for any Java code that is

   * not to be visible to other controllers/views or that contains constructs

   * currently not supported directly by Web Dynpro (such as inner classes or

   * member variables etc.). </p>

   *

   * Note: The content of this section is in no way managed/controlled

   * by the Web Dynpro Designtime or the Web Dynpro Runtime.

   */

  //@@begin others

  String connectiontext="jdbc:oracle:thin:@lepdb.lancogroup.net:1527:LEP";

  String user="epuser";

  String pwd="userep51";

  

  Connection conn=null;

  Statement stmt=null;

   Statement sql1=null;

   Statement sql2= null;

  //@@end

}

I am not getting what is my mistake?

please help

Accepted Solutions (1)

Accepted Solutions (1)

govardan_raj
Contributor
0 Kudos

hi Shilpi ,


I hope data is not getting displayed is that right ?

---------------------------------------------------------------------------------------------------------------------------

wdContext.nodeKey().invalidate(); 

  wdContext.nodeManhour().invalidate();

  wdContext.nodeIncidence().invalidate();

  wdContext.nodeLost_time().invalidate();

  wdContext.nodeLegal().invalidate();

  wdContext.nodeTrainings().invalidate();

  wdContext.nodeInspection().invalidate();

  wdContext.nodeOccupation().invalidate();

  wdContext.nodeEmergency().invalidate();

  wdContext.nodeEnvironment().invalidate();

  wdContext.nodeContract().invalidate();

  IPrivateZcumulative_displayView.IKeyElement key = wdContext.currentKeyElement();

  IPrivateZcumulative_displayView.IManhourElement man = wdContext.currentManhourElement();

  IPrivateZcumulative_displayView.IIncidenceElement inc = wdContext.currentIncidenceElement();

  IPrivateZcumulative_displayView.ILost_timeElement los = wdContext.currentLost_timeElement();

  IPrivateZcumulative_displayView.ILegalElement leg = wdContext.currentLegalElement();

  IPrivateZcumulative_displayView.ITrainingsElement tra = wdContext.currentTrainingsElement();

here you are taking currentelement , is the nodeKey() ,nodeManHour() cardinality is 1...1 or 0...n ?

if it is 1...1 , then try to print the values you are getting from the resultset  so you will come toknow if it is coming from back end or not .

if it is 0..n then you have to create an element i.e wdContext.createKeyElement() etc and then after setting the values add this element to corresponding node.

---------------------------------------------------------------------------------------------------------------------------

Regards

Govardan

Former Member
0 Kudos

Hi Govardan,

The cardinality ratio is 1...1 and the data is displaying. I want is in the same view different site data should be displayed with same fields, as i told you that data is filed in a given form, like in excel we have different columns in the same spreadsheet.

Do I need to create separate context elements for each site?

govardan_raj
Contributor
0 Kudos

hi shipi ,

Im not clear with your requirement , like if you want to display different form data in the same input feild then it is simple ,  in the above action   public void onActiondisplay() -- you are executing the  query and displaying the data , just create one method in component controller with

displayformfeilds( String formType)

{

     //here put the same code that is onActiondisplay()

}

now here use the input parameter formType to differentiate which form data you want to fetch from the database , .

if you want to display for example say you have 5 different forms, and you wanna display them in the same view at the same time , then you have to display them in table binded to a node having cardinality of 0...n and here each row represents one form data

Row1 --> form1 data

Row2 --> form2 data

Row3 --> form3 data

Row4 --> form4 data

Row5 --> form5 data

or you want to display them using input feilds or textview , then you have to create seperate node for each forms  

Regards

Govardan

Former Member
0 Kudos

hi Govardan,

I am displaying 5 different sites in the same view for example: for bg1: site1, site2, site3, site4, site5 should come. i am displaying them with the help inputfield. wat will be the code and sql statement for dat?

govardan_raj
Contributor
0 Kudos

hi shilpi ,

Here in group--> bg1:site1 to site5 is fixed or it changes dynamically ?

if it if fixed then you can display them create 5 different nodes nodesite1, ... nodesite5 etc.. and display them , if it is dynamic that is site5 .. siteN based on group , then as told earlier you can show that in table or you want to display via input feilds , then dynamic creation of Input UI elements and adding them to the view should be done .

wat will be the code and sql statement for dat?

sql statment -- the query which you have already written , instead of using query  , you can go with stored procedures that is better way of coding and fetch the output data via cursor.

Regards

Govardan


Former Member
0 Kudos

Hi Govardan,

I am applying IF - ELSE statement in the code. when i am specifying the if condition like

if (ele.getBusiness_group() == "EPC")

the code is not working

and when i am null in place of epc it is working.

is there any solution for that?

govardan_raj
Contributor
0 Kudos

hi shilpi ,

here you can use

if(ele.getBusines_group().equalsIgnorecase("EPC")

for strings you can use .equalsIgnorecase and not "=="

Regards

Govardan Raj

Answers (0)