Saturday, October 19, 2013

Dynamic Prompt - with Dynaic view

in every field change write criteria Function -

Declare Function Build_WhereClause PeopleCode MHN_PENDDOC_REC.EMPLID FieldFormula;

Build_WhereClause();

Where Clause Function : in EMPLID field formula

Function Build_WhereClause
   
   Local string &where_clause, &sql1;
   
   If All(MHN_PENDDOC_REC.INSTITUTION.Value) Then
      &where_clause = &where_clause | "INSTITUTION='" | MHN_PENDDOC_REC.INSTITUTION.Value | "' ";
   End-If;
   
   If All(MHN_PENDDOC_REC.ACAD_CAREER.Value) Then
      &where_clause = &where_clause | "AND ACAD_CAREER='" | MHN_PENDDOC_REC.ACAD_CAREER.Value | "' ";
   End-If;
   
   If All(MHN_PENDDOC_REC.STRM.Value) Then
      &where_clause = &where_clause | "AND STRM='" | MHN_PENDDOC_REC.STRM.Value | "' ";
   End-If;
   
   If All(MHN_PENDDOC_REC.CAMPUS.Value) Then
      &where_clause = &where_clause | "AND CAMPUS='" | MHN_PENDDOC_REC.CAMPUS.Value | "' ";
   End-If;
   
   If All(MHN_PENDDOC_REC.ACAD_PLAN.Value) Then
      &where_clause = &where_clause | "AND ACAD_PLAN='" | MHN_PENDDOC_REC.ACAD_PLAN.Value | "' ";
   End-If;
   
   If All(MHN_PENDDOC_REC.CLASS_SECTION.Value) Then
      &where_clause = &where_clause | "AND CLASS_SECTION='" | MHN_PENDDOC_REC.CLASS_SECTION.Value | "' ";
   End-If;
   
   If All(MHN_PENDDOC_REC.ADMIT_TYPE.Value) Then
      &where_clause = &where_clause | "AND ADMIT_TYPE='" | MHN_PENDDOC_REC.ADMIT_TYPE.Value | "' ";
   End-If;
   rem WinMessage(&where_clause);
   If Left(&where_clause, 3) = "AND" Then
      &where_clause = Replace(&where_clause, 1, 3, "");
   End-If;
   If All(&where_clause) Then
      &where_clause = "WHERE" | &where_clause;
   End-If;
   &sql1 = " SELECT DISTINCT EMPLID,NAME FROM PS_MHN_XML_EMP4_VW " | &where_clause;
   
   
   MHN_PENDDOC_REC.EMPLID.SqlText = &sql1;
End-Function;

in EMPLID Rowinit

MHN_PENDDOC_REC.EMPLID.SqlText = "SELECT DISTINCT EMPLID, NAME  FROM PS_MHN_XML_EMP4_VW";

No comments:

Post a Comment