Home » Developer & Programmer » Forms » how to use updated temptable data in report (merged by CM)
how to use updated temptable data in report (merged by CM) [message #452926] Mon, 26 April 2010 05:43 Go to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
here is the scenario , I have the manipulated data on temporary table name "tempdata" and i want to display it in to my report, I am using the temporary table, and also call report from the same session on which data is updated on temporary table. but its still not showing data on the report, I think this is the session problem of the form but i also call report from the same form , so the session should b same for both the report as well as for the form, so y don't the report show the temporary table data.. Help me somebody.
Re: how to use updated temptable data in report [message #452932 is a reply to message #452926] Mon, 26 April 2010 06:32 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Simple answer - you can't.
Reports always runs in a different session to forms as it's run by a different server process.

You can't use a global temp table for this, you need to use a permanent table.
Re: how to use updated temptable data in report [message #452933 is a reply to message #452932] Mon, 26 April 2010 06:44 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
i am using the table with ON COMMIT PRESERVE ROWS , and also calling the report from the same form, so y is it impossible ??? and if it is not possible then how can i show temptable data on my report??
Re: how to use updated temptable data in report [message #452934 is a reply to message #452926] Mon, 26 April 2010 07:02 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
Actually i have an employee search form and for some reasons i have to store all employees information in to temp table and then show them all in a report, now i can pass all employees in parameter to the report, because i have more than 10k records so i cann't use the varchar variable to ,because it's limitted. so i have to store the information in to the temp table and access that from the report to show.
hope you understand the problem.
Re: how to use updated temptable data in report [message #452936 is a reply to message #452926] Mon, 26 April 2010 07:02 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
What part of "you can't" do you not understand?
Forms and reports run in different sessions always.
There is no way round this.
Re: how to use updated temptable data in report [message #452937 is a reply to message #452926] Mon, 26 April 2010 07:05 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You have two options:
1) Pass the search criteria you used in the form to the report and make it look up the data in the same way the form is.
2) Write the emp ids to a permanent table along with a session identifier. Pass the session identifier to the report. Have the report query based on that table. Delete the rows you've added when you're done.
Re: how to use updated temptable data in report [message #452938 is a reply to message #452926] Mon, 26 April 2010 07:14 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
i am avoiding the 1st option because i have 45 fields of criteria, and have you any example of the second one ?? an one more thing that i can't use the permanent table for some reasons , i am restricted to use the temp table for this assignment.
Re: how to use updated temptable data in report [message #452939 is a reply to message #452926] Mon, 26 April 2010 07:18 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
please send me your email so i can send you screenshots , and you understand easily, can we change the session id of forms and reports by ourselves ??? i want to use this approch because this is unique in my product
Re: how to use updated temptable data in report [message #452947 is a reply to message #452926] Mon, 26 April 2010 08:31 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you want to post screenshots do it here.

You can not use a temp table

I really do not want to have to repeat that again!

Create a table with two columns:
EMPLOYEE_ID (or what ever the pk of your employee table is)
SESSION_ID - populate this with the session_id from forms, or from a sequence. It can be anything you like as long as it's unique to your current forms session.

Insert the employee ids into that table using the same value for session_id for all rows. Pass the session_id to the report. Query the table in the report using the session_id.
Once the report has run delete all rows in that table with the current session_id.
It has to be a permanent table.
Re: how to use updated temptable data in report [message #453021 is a reply to message #452947] Mon, 26 April 2010 14:33 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Actually, if you love global temporary tables that much, you *could* use one here, but that would be quite stupid.

Here it goes: code (procedures, whatever) you use in a form in order to display records copy to report (you can write your own PL/SQL procedures there too). So, you'd basically calculate everything twice: once in a form, then in a report again. Report PL/SQL could insert in to a GTT and report can then read it in order to display values. It means that all the computing must be done before report runs its query(es), so candidates are Before Report or After Parameter Form report triggers.

Obviously, the whole job would be quite stupid because - why would anyone want to do the same job twice, once in a form and then in a report? Though, if it takes miliseconds, go on. Just remember that every change must be synchronized between form and report. Perhaps you could move PL/SQL procedures into the database (i.e. make them stored procedures) and call them from both form and report. Is it worth the pain? I'd go with Cookiemonster's suggestion and use an ordinary table.
Re: how to use updated temptable data in report [message #453065 is a reply to message #452947] Tue, 27 April 2010 00:34 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
cookiemonster wrote on Mon, 26 April 2010 08:31
If you want to post screenshots do it here.

You can not use a temp table

I really do not want to have to repeat that again!

Create a table with two columns:
EMPLOYEE_ID (or what ever the pk of your employee table is)
SESSION_ID - populate this with the session_id from forms, or from a sequence. It can be anything you like as long as it's unique to your current forms session.

Insert the employee ids into that table using the same value for session_id for all rows. Pass the session_id to the report. Query the table in the report using the session_id.
Once the report has run delete all rows in that table with the current session_id.
It has to be a permanent table.


Thankyou dear,
ya dear i agree with you , I am also uploding screen shots today. do you have any good example related to passing the forms session id to the report and on the report generate query using that session id ???? if you have any good example then share here , It will b very appreciative.Thankyou.
Re: how to use updated temptable data in report [message #453066 is a reply to message #452926] Tue, 27 April 2010 00:57 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
This is first screen with all Criteria and execute button.
http://img12.imageshack.us/img12/5815/pas520.png

This is second screen with all records

http://img249.imageshack.us/img249/1673/recordstodisplay.png
I want to display these fields as it is , in to the report, This is the screen from which i call report.
Re: how to use updated temptable data in report [message #453112 is a reply to message #452926] Tue, 27 April 2010 03:46 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you create the table and populate it as I told you this is really simple, not sure why you're having an issue. Just pass the session_id as a parameter then change the query in the report to link employees to the new table and restrict the new table with the parameter session_id.
I can't give you any examples as I don't have working forms and reports handy, but really you shouldn't need any.
Re: how to use updated temptable data in report [message #453384 is a reply to message #453112] Wed, 28 April 2010 07:50 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
thankyou dear , it's helped very much i am working on it, now i want to ask a little question that how can we get the current directory path from oracle forms, for example i want to call a form which is located on the same directory so how can i we get the active directory path. Just as %ORACLE_HOME% POINTS TO ORACLE HOME DIRECTORY.SO FOR THE CURRENT WORKING DIRECTORY WHAT WE USE?? WITH OUT USING ENVIRONMENTAL variable.
Re: how to use updated temptable data in report [message #453421 is a reply to message #453384] Wed, 28 April 2010 16:13 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Add current working directory to path.
Re: how to use updated temptable data in report [message #453428 is a reply to message #453421] Wed, 28 April 2010 23:35 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
which path dear i don't understand, Actually dear it's simple but not that simple Razz , Actually i want My application portable, i want where ever my application deploy it dynamically get that current working directory path and call my all forms form the current directory in which all files of my application placed. Now you understand ???
[EDITED by DJM: delete useless quote]

[Updated on: Thu, 29 April 2010 23:05] by Moderator

Report message to a moderator

Re: how to use updated temptable data in report [message #453440 is a reply to message #453428] Thu, 29 April 2010 00:33 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What version of forms are you using?

David
Re: how to use updated temptable data in report [message #453513 is a reply to message #453440] Thu, 29 April 2010 05:36 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
i am using forms 6. Anyway this issue is resolved and now working on main issue.if anyone give suggestion related to that , it will be very applicative step.

Thankyou all.
[EDITED by DJM: delete useless quote]

[Updated on: Thu, 29 April 2010 23:05] by Moderator

Report message to a moderator

Re: how to use updated temptable data in report [message #453525 is a reply to message #452926] Thu, 29 April 2010 07:00 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Huh?

We've given you suggestions on the main issue already. If you've got a specific issue with implementing our suggestions let us know and we'll help you out. Otherwise I'm really not sure what you are expecting.
Re: how to use updated temptable data in report [message #453601 is a reply to message #453513] Thu, 29 April 2010 23:06 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
And stop with the quoting of the previous post. We CAN read.

David
Re: how to use updated temptable data in report [message #453980 is a reply to message #452926] Mon, 03 May 2010 05:31 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
how can i get session id of form? Currently i am getting using v$session , if you are asking about this then this is gud and how can we get the data of specific session from report ?? can we run report for the specific session ??
Re: how to use updated temptable data in report [message #454078 is a reply to message #453980] Tue, 04 May 2010 00:58 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You can get the session id from 'v$mystat'.

select distinct sid
  from v$mystat


I don't believe that you can get information from other sessions. But you can try it.

David
GLOBAL TEMPORARY TABLES DATA NOT SHOWS IN REPORT [message #454125 is a reply to message #452926] Tue, 04 May 2010 03:02 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
I am using Global temporary table "on commit preserve rows". I insert some data in to it and want to show that data on the report , when i generate report from that form the report shows nothing, But the data exists on that Temporary table, I think the problem is with session , as i know that the form and report have different session id's. What i should do now ?? i am using oracle Developer 6. Is there any way to show that data on my report. The report is generated from the same form.
Re: GLOBAL TEMPORARY TABLES DATA NOT SHOWS IN REPORT [message #454126 is a reply to message #454125] Tue, 04 May 2010 03:07 Go to previous messageGo to next message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
If you are calling any RDF from the form
1)HOw you are populating the GTT?
If you are using any procedure to populate that GTT then call that proc in the after parametere form on RDF file so that it will give you the data...

sriram Smile
Re: how to use updated temptable data in report [message #454141 is a reply to message #453980] Tue, 04 May 2010 04:04 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
bl4ckc0der wrote on Mon, 03 May 2010 11:31
can we run report for the specific session ??


No. Really No.

That's why you've got to create a real table and pass the session_identifier through to the report as a parameter.
Re: GLOBAL TEMPORARY TABLES DATA NOT SHOWS IN REPORT [message #454146 is a reply to message #454125] Tue, 04 May 2010 04:22 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
bl4ckc0der wrote on Tue, 04 May 2010 09:02
I am using Global temporary table "on commit preserve rows". I insert some data in to it and want to show that data on the report , when i generate report from that form the report shows nothing, But the data exists on that Temporary table, I think the problem is with session , as i know that the form and report have different session id's. What i should do now ?? i am using oracle Developer 6. Is there any way to show that data on my report. The report is generated from the same form.


1) Don't repost the same question in multiple forums.
2) We've told you why this won't work and what you need to do - the answer is not going to change no matter how many times you ask.
Re: how to use updated temptable data in report (merged by CM) [message #454151 is a reply to message #452926] Tue, 04 May 2010 04:32 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
dear cookiemaster this is the easyiest way to solve my problem that's y i am searching it from that long, I also follow you, but not know how to get sessionid of the report for that permanent table, if you describe furtherer then it will solve this issue , so please show some flexibility.. Thankyou. I get the from sessionid for the permanant table and also can send that as a parameter to that report , then how can i use that in the report ??? and if we use permanant table then y we need to send session id as parameter, the report already show the data then,
Re: how to use updated temptable data in report (merged by CM) [message #454152 is a reply to message #452926] Tue, 04 May 2010 04:36 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
i am not fully understand your technique, if you ask for code behind those buttons so i can show you personally, if you say, it's much important work for me,
Re: how to use updated temptable data in report (merged by CM) [message #454156 is a reply to message #454151] Tue, 04 May 2010 04:52 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
bl4ckc0der wrote on Tue, 04 May 2010 10:32

dear cookiemaster this is the easyiest way to solve my problem that's y i am searching it from that long,

I assume you're talking about global temp tables here - there's nothing easy about the impossible.

bl4ckc0der wrote on Tue, 04 May 2010 10:32

I also follow you, but not know how to get sessionid of the report for that permanent table,

You don't need the session id of the report, just the form.

bl4ckc0der wrote on Tue, 04 May 2010 10:32

if you describe furtherer then it will solve this issue , so please show some flexibility..

I've described it step by step - telling me exactly what you don't understand helps.

bl4ckc0der wrote on Tue, 04 May 2010 10:32

I get the from sessionid for the permanant table and also can send that as a parameter to that report , then how can i use that in the report ???

The same way you'd use any parameter in a report? You refer to it in the where clause of the query:
SELECT  <columns>
FROM emp e, permanent_table pt
WHERE e.emp_id = pt.emp_id
AND pt.session_id = p_session_id;


bl4ckc0der wrote on Tue, 04 May 2010 10:32

and if we use permanant table then y we need to send session id as parameter, the report already show the data then,

And what happens if two different users run that same report at the same time?
They'll see each others data. Which is why you need the parameter.
Re: how to use updated temptable data in report (merged by CM) [message #454181 is a reply to message #452926] Tue, 04 May 2010 06:34 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
dear this is not that simple query , that's why i ask from you guru's. I sended you the code of execute btn. Chk this and then tell me .
Re: how to use updated temptable data in report (merged by CM) [message #454183 is a reply to message #454181] Tue, 04 May 2010 06:38 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
bl4ckc0der wrote on Tue, 04 May 2010 12:34
I sended you the code of execute btn. Chk this and then tell me .


I can't see any such code, where is it?
Re: how to use updated temptable data in report (merged by CM) [message #454184 is a reply to message #454183] Tue, 04 May 2010 06:46 Go to previous messageGo to next message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
It is on the way....
you should have pationce..

@op
CHK=check? or Cheque?
Dont Use IM speak....

sriram Smile
Re: how to use updated temptable data in report (merged by CM) [message #454187 is a reply to message #454184] Tue, 04 May 2010 06:58 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
ramoradba wrote on Tue, 04 May 2010 12:46
It is on the way....
you should have pationce..


"sended" reads like past-tense. Hence I assumed it was already posted.
Re: how to use updated temptable data in report (merged by CM) [message #454188 is a reply to message #452926] Tue, 04 May 2010 06:59 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
The following is from a PM from the OP:

The following code is behind the execute button as you see in the 1st screen.
PROCEDURE ExecuteBtn IS
--
VTotalRows number ;
RgId RecordGroup ;
--
--The following variables will hold the multiple values of their selcted criteria for multiselection.
--
EmpIdStr varchar2(600) ; --used to hold empid,first name,middle name,last name employeeno numbers.
EmpFrstNmeEmpNoStr varchar2(600) ; --In case of multiple frist name choice.
EmpMiddleNmeEmpNoStr varchar2(600) ; --In case of multiple middle name choice.
EmpLastNmeEmpNoStr varchar2(600) ; --In case of multiple last name choice.
EmpOUNoStr varchar2(600) ; --In case of multiple ou choice.
EmpJobNoStr varchar2(600) ; --In case of multiple jobs choice.
EmpPosNoStr varchar2(600) ; --In case of multiple position choice.
----
EmpGrpNoStr varchar2(600) ; --In case of multiple emp group choice.
EmpPaNoStr varchar2(600) ; --In case of multiple emp personnal area choice.
EmpPrAreaNoStr varchar2(600) ; --In case of multiple emp Pay roll area choice.
EmpTmaNoStr varchar2(600) ; --In case of multiple emp time management area choice.
EmpBAreaNoStr varchar2(600) ; --In case of multiple business area choice.
EmpTypeNoStr varchar2(600) ; --In case of multiple emp type area choice.
EmpStatusNoStr varchar2(600) ; --In case of multiple emp Status area choice.
EmpDeploymentNoStr varchar2(600) ; --In case of multiple emp deployment area choice.
EmpResponNoStr varchar2(600) ; --In case of multiple emp responsibility area choice.
EmpQualifNoStr varchar2(600) ; --In case of multiple emp Qualification area choice.
EmpQualifLevelNoStr varchar2(600) ; --In case of multiple emp Qualification level choice.
EmpExperienceNoStr varchar2(600) ; --In case of multiple Emperience choice.
EmpExperienceLevNoStr varchar2(600) ; --In case of multiple Emperience level choice.
EmpSkillNoStr varchar2(600) ; --In case of multiple Skill choice.
EmpSkillLevelNoStr varchar2(600) ; --In case of multiple Skill level choice.
EmpComptncyNoStr varchar2(600) ; --In case of multiple competency choice.
EmpMaritalNoStr varchar2(300) ; --In case of multiple maritallity choice.
EmpNationalityNoStr varchar2(250) ; --In case of multiple nationality choice.
EmpNicNoStr varchar2(1000) ; --In case of multiple national id card choice.
EmpSSNStr varchar2(1000) ; --In case of single SOCIAL SECURITY NUMBER id card choice.
EmpTaxNoStr varchar2(1000) ; --In case of multiple tax no choice.
--
EmpDateOfBrthFromStr varchar2(500) ; --In case of multiple birth from dates choice.
EmpDateOfBrthToStr varchar2(500) ; --In case of multiple birth To dates choice.
DateOfBrthToExistFlag varchar2(30) ; --Flag to know wether any multiple dates have been selected or not.
--
JoinDateFromStr varchar2(500) ; --In case of multiple birth from dates choice.
JoinDateToStr varchar2(500) ; --In case of multiple birth To dates choice.
JoinDateFromToExistFlag varchar2(30) ; --Flag to know wether any multiple dates have been selected or not.
-- 
begin
--the folowings are the Vield variables where different queries are being strored for processing.
-- 1 :CrieTeria.QueryStringForOrgStruct varchar2(1500) ;
-- 2 :CrieTeria.QueryStringForEmpEpStruct varchar2(1500) ;
-- 3 :CrieTeria.QueryStringForTma varchar2(1500) ;

--First initialize the where clause query string with null
:CrieTeria.QueryString := null ;
:CrieTeria.QueryStringForOrgStruct := null ;
:CrieTeria.QueryStringForEmpEpStruct := null ;
:CrieTeria.QueryStringForTma := null ;
Set_block_property('HRMPASEMPLOYEE',default_where, '') ; 
--
--QueryStringForOrgStruct variable is being used to make a string for where clause of hrmpasemployee on hrmpasemporgstruct combination.
--
:CrieTeria.QueryStringForOrgStruct := ' and EmployeeNo in(select e.employeeno from HrmpasEmployee e, HrmPasEmpOrgStruct t where t.employeeno = e.EmployeeNo and t.PlanNo = :CrieTeria.PlanNo and t.Status = 1' ; 
--
--
--QueryStringForEmpEpStruct variable is being used to make a string for where clause of hrmpasemployee on HrmPasEmpEpStruct combination.
--
:CrieTeria.QueryStringForEmpEpStruct := ' and EmployeeNo in(select e.employeeno 
from HrmpasEmployee e,
HrmPasEmpEpStruct ep 
where ep.employeeno = e.EmployeeNo 
and ep.PlanNo = :CrieTeria.PlanNo
and ep.Status = 1
and ep.co = :B0.co ' ; 
--
--
--QueryStringForTma variable is being used to make a string for where clause of hrmpasemployee on hrmpasemporgstruct combination.
--
:CrieTeria.QueryStringForTma := ' and EmployeeNo in(select e.employeeno 
from HrmpasEmployee e,
HrmPasEmpTma tm 
where tm.employeeno = e.EmployeeNo 
and tm.PlanNo = :CrieTeria.PlanNo
and tm.Status = 1' ; 


---------------------------------------------------------------------------------------------------------------------------------
RgId := Find_Group('MultSelectionRecGrp') ;
VTotalRows := Get_group_row_count(RgId) ;
--
--The following loop brings records that have been choosen from multiple option.
--
for i in 1..VTotalRows loop
if Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 1 then
--If employeeid is selected then
EmpIdStr := EmpIdStr ||' OR EMPLOYEEID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.Id', i)||'''' ;
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 2 then
--If employe's name button has been selected multiple then
EmpFrstNmeEmpNoStr := EmpFrstNmeEmpNoStr ||' OR FIRSTNAME LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 3 then
--If employe Middle name has been selected multiple then
EmpMiddleNmeEmpNoStr := EmpMiddleNmeEmpNoStr ||' OR MIDDLENAME LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 4 then
--If employe Last name button has been selected for mulitple choice then
EmpLastNmeEmpNoStr := EmpLastNmeEmpNoStr ||' OR LASTNAME LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 5 then
--Orgainzational Unit
EmpOUNoStr := EmpOUNoStr ||' OR ORGUNITID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 6 then
--Job no selection
EmpJobNoStr := EmpJobNoStr ||' OR JobId LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 7 then 
--Position id is selected
EmpPosNoStr := EmpPosNoStr ||' OR POSID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 8 then 
--Employee Group
EmpGrpNoStr := EmpGrpNoStr ||' OR GROUPID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 9 then 
--personnal area
EmpPaNoStr := EmpPaNoStr ||' OR PANO LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 10 then 
--Business area
EmpBAreaNoStr := EmpBAreaNoStr ||' OR BAID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 11 then 
--Time management area
EmpTmaNoStr := EmpTmaNoStr ||' OR TMAID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 12 then 
--Pay Roll area
EmpPrAreaNoStr := EmpPrAreaNoStr ||' OR PraNo LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 13 then 
--Employee Type
EmpTypeNoStr := EmpTypeNoStr ||' OR EMPTYPE LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 14 then 
--Employee Status
EmpStatusNoStr := EmpStatusNoStr ||' OR EMPNATSTAT LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 15 then 
--Employee Deployement
EmpDeploymentNoStr := EmpDeploymentNoStr ||' OR EMPNATSTAT LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 17 then 
--Employee Responsibility
EmpResponNoStr := EmpResponNoStr ||' OR RESPONSIBILITYID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 18 then 
--Employee Qualification
EmpQualifNoStr := EmpQualifNoStr ||' OR QualificationID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 19 then 
--Employee Qualification level
EmpQualifLevelNoStr := EmpQualifLevelNoStr ||' OR LEVELID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 20 then 
--Employee Experiecne
EmpExperienceNoStr := EmpExperienceNoStr ||' OR EXPID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 21 then 
--Employee Experiecnelevel
EmpExperienceLevNoStr := EmpExperienceLevNoStr ||' OR LEVELID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 22 then 
--Employee Skill
EmpSkillNoStr := EmpSkillNoStr ||' OR SKILLID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 23 then 
--Employee Skill level
EmpSkillLevelNoStr := EmpSkillLevelNoStr ||' OR LEVELID LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 24 then 
--Employee Compentency
EmpComptncyNoStr := EmpComptncyNoStr ||' OR COMP LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ; 
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 26 then 
--Employee Marital Status
EmpMaritalNoStr := EmpMaritalNoStr ||' OR MSDESC LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.Descr', i)||'''' ; 
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 27 then 
--Employee Nationality
EmpNationalityNoStr := EmpNationalityNoStr ||','||Get_Group_Char_Cell('MultSelectionRecGrp.No', i) ; 
if EmpNationalityNoStr = ',' then
EmpNationalityNoStr := null ;
end if ; 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 28 then 
--Employee National id card no
EmpNicNoStr := EmpNicNoStr ||' OR IDNO LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
-- 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 34 then 
--Employee SOCIAL SECURITY NUMBER card no
EmpSSNStr := EmpSSNStr ||' OR SSNO LIKE '''||Get_Group_Char_Cell('MultSelectionRecGrp.id', i)||'''' ;
--
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 29 then 
--Employee tax no
EmpTaxNoStr := EmpTaxNoStr ||','||Get_Group_Char_Cell('MultSelectionRecGrp.No', i) ; 
if EmpTaxNoStr = ',' then
EmpTaxNoStr := null ;
end if ; 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 30 then 
--Birth Dates flag
DateOfBrthToExistFlag := Get_Group_Char_Cell('MultSelectionRecGrp.ID', i) ;
DateOfBrthToExistFlag := DateOfBrthToExistFlag ||Get_Group_Char_Cell('MultSelectionRecGrp.descr', i) ; 
elsif Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 31 then 
--Joining dates flag
JoinDateFromToExistFlag := Get_Group_Char_Cell('MultSelectionRecGrp.ID', i) ;
JoinDateFromToExistFlag := DateOfBrthToExistFlag ||Get_Group_Char_Cell('MultSelectionRecGrp.descr', i) ; 
end if ;
--
end loop ;

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

--
--The following if structure will make a dynamic where clause string for the result block to show
--against the selected criteria or options to filter employee.
--this also first checks the which criteria user has selected to search and makes the query accordingly.
--
:CrieTeria.QueryString := 'Co = :B0.co ' ;
--The following if elsif structure check that wether male or female employees are to be sorted.
if :CrieTeria.Male = 'M' and :CrieTeria.Female <> 'F' then
:CrieTeria.QueryString := :CrieTeria.QueryString || ' AND Gender = '''||'MALE'''||'' ;
elsif :CrieTeria.Male <> 'M' and :CrieTeria.Female = 'F' then
:CrieTeria.QueryString := :CrieTeria.QueryString || ' AND Gender = '''||'FEMALE'''||'' ;
--message('Femal selected :'||:CrieTeria.QueryString) ;pause ;
elsif :CrieTeria.Male = 'M' and :CrieTeria.Female = 'F' then
:CrieTeria.QueryString := :CrieTeria.QueryString || ' AND ( Gender = '''||'MALE'||''''||' OR Gender = '''||'FEMALE'''||')' ;
end if ; -- if :CrieTeria.Male = 'M' and :CrieTeria.Female <> 'F' then
--
--The following if elsif structure check that wether active or inactive employees are to be sorted.
if :CrieTeria.Active = 1 and :CrieTeria.Inactive <> 1 then
:CrieTeria.QueryString := :CrieTeria.QueryString || ' AND Active = 1 ' ;
elsif :CrieTeria.Active <> 1 and :CrieTeria.Inactive = 1 then
:CrieTeria.QueryString := :CrieTeria.QueryString || ' AND Active = 0 ' ;
--message('Femal selected :'||:CrieTeria.QueryString) ;pause ;
elsif :CrieTeria.Active = 1 and :CrieTeria.Inactive = 1 then
:CrieTeria.QueryString := :CrieTeria.QueryString || ' AND ( Active = 1 OR Active = 0 )' ;
end if ; -- if :CrieTeria.Active = 1 and :CrieTeria.Inactive <> 1 then
----------------------------------------
if :CrieTeria.EmpID is not null 
or EmpIdStr is not null then
--if user has selected employeeno to search then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and( Employeeid like '''||:CrieTeria.EMPid||''''||EmpIdStr||')' ;
--
end if ; --if :CrieTeria.EmployeeNo is not null .
-- 
if :CrieTeria.FIRSTNM is not null 
or EmpFrstNmeEmpNoStr is not null then
--if user has selected employee's first name to search then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and( FIRSTNAME like '''||:CrieTeria.FIRSTNM||''''||EmpFrstNmeEmpNoStr||')' ;
--
end if ; --if :CrieTeria.FirstNm is not null then
-- 
if :CrieTeria.MIDDLENM is not null 
or EmpMiddleNmeEmpNoStr is not null then
--if user has selected employeen's middle name to search then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and( MIDDLENAME like '''||:CrieTeria.MIDDLENM||''''||EmpMiddleNmeEmpNoStr||')' ;
--
end if ; --if :CrieTeria.MiddleNm is not null then
--
if :CrieTeria.LASTNM is not null 
or EmpLastNmeEmpNoStr is not null then
--
--if user has selected employeen's last name to search then LASTNAME
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and( LASTNAME like '''||:CrieTeria.LASTNM||''''||EmpLastNmeEmpNoStr||')' ;
--
end if ; --if :CrieTeria.LastNm is not null then
--

if :CrieTeria.MERITALSTATUS is not null 
or EmpMaritalNoStr is not null then --marital status
--
--if user has selected employeen's Country to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and MsNO in(SELECT MsNO
FROM Hrmpasmaritalstatus 
where ( MSDESC like '||''''||:CrieTeria.MERITALSTATUS||''''||EmpMaritalNoStr||'))' ; 
--
end if ; --if :CrieTeria.CountryNo is not null then 
--
if :CrieTeria.CountryNo is not null 
or EmpNationalityNoStr is not null then
--
--if user has selected employeen's Nationality to search then
--
if :CrieTeria.CountryNo is null then
--
EmpNationalityNoStr := ltrim(EmpNationalityNoStr,',') ;
end if; 
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and CountryNo in( '||:CrieTeria.CountryNo||EmpNationalityNoStr||')' ;
--
end if ; --if :CrieTeria.CountryNo is not null then
--
if :CrieTeria.NicId is not null 
OR EmpNicNoStr is not null then
--
--if user has selected employeen's Nic no to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and( IDNO like '''||:CrieTeria.NICID||''''||EmpNicNoStr||')' ;
--
end if ; --if :CrieTeria.NicId is not null then
--------------------------------------------------------------------
if :CrieTeria.SSN is not null 
OR EmpSSNStr is not null then
--if user has selected employeen's Nic no to search then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and( SSNO like '''||:CrieTeria.SSN||''''||EmpSSNStr||')' ;
--
end if ;
----------------------------------------------------------------------
--
--
if :CrieTeria.TaxNo is not null 
or EmpTaxNoStr is not null then
--
--if user has selected employeen's TaxNo to search then
--
if :CrieTeria.TaxNo is null then
--
EmpTaxNoStr := ltrim(EmpTaxNoStr,',') ;
end if; 
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and TaxNo in( '||:CrieTeria.TaxNo||EmpTaxNoStr||')' ;
--
end if ; --if :CrieTeria.TaxNo is not null then
--
--Multiple and single date setting in the where clause----
--
if :CrieTeria.DateOfBirthFrom is not null 
or :CrieTeria.DateOfBirthTo is not null
or DateOfBrthToExistFlag is not null then
--
if DateOfBrthToExistFlag is not null
and (:CrieTeria.DateOfBirthFrom is not null 
or :CrieTeria.DateOfBirthTo is not null) then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and DoB between '||''''||to_char(:CrieTeria.DateOfBirthFrom,'DD-MON-RRRR')||''''||' and '||''''||to_char(:CrieTeria.DateOfBirthTo,'DD-MON-RRRR')||''''||' or ' ;
elsif DateOfBrthToExistFlag is null then
-- MESSAGE('MESSAGE 3');PAUSE ;
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and DoB between '||''''||to_char(:CrieTeria.DateOfBirthFrom,'DD-MON-RRRR')||''''||' and '||''''||to_char(:CrieTeria.DateOfBirthTo,'DD-MON-RRRR')||'''' ;
elsif DateOfBrthToExistFlag is not null
and :CrieTeria.DateOfBirthFrom is null 
and :CrieTeria.DateOfBirthTo is null then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and ' ;
end if ; --if DateOfBrthToExistFlag is not null then

--
for i in 1..VTotalRows loop
--
if Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 30 then 
--Employee Date of births from
EmpDateOfBrthFromStr := Get_Group_Char_Cell('MultSelectionRecGrp.ID', i) ; --FRM DATE
--Employee Date of births to
EmpDateOfBrthToStr := Get_Group_Char_Cell('MultSelectionRecGrp.DESCR', i) ; --TO DATE
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' DoB between '||''''||to_date(EmpDateOfBrthFromStr,'DD-MM-RRRR')||''''||' and '||''''||to_date(EmpDateOfBrthToStr,'DD-MM-RRRR')||''''||' OR ' ;
end if ;
--
end loop ;
:CrieTeria.QueryString := RTRIM(:CrieTeria.QueryString,' OR ') ;
--
end if ; -- if :CrieTeria.DateOfBirthFrom is not null then
--------------------------end---of--the--Date--of birth--settings-----------------------

------------start--of--Joining--date----logic----------------------
--Multiple and single date setting in the where clause-------------------------------------
--
if :CrieTeria.JoiningDateFrom is not null 
or :CrieTeria.JoiningDateTo is not null
or JoinDateFromToExistFlag is not null then
--
if JoinDateFromToExistFlag is not null
and (:CrieTeria.JoiningDateFrom is not null 
or :CrieTeria.JoiningDateTo is not null) then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and JOININGDATE between '||''''||to_char(:CrieTeria.JoiningDateFrom,'DD-MON-RRRR')||''''||' and '||''''||to_date(:CrieTeria.JoiningDateTo,'DD-MM-RRRR')||''''||' or ' ;
elsif JoinDateFromToExistFlag is null then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and JOININGDATE between '||''''||to_char(:CrieTeria.JoiningDateFrom,'DD-MON-RRRR')||''''||' and '||''''||to_date(:CrieTeria.JoiningDateTo,'DD-MM-RRRR')||'''' ;
elsif JoinDateFromToExistFlag is not null
and :CrieTeria.JoiningDateFrom is null 
and :CrieTeria.JoiningDateTo is null then
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and ' ;
end if ; --if DateOfBrthToExistFlag is not null then
--
for i in 1..VTotalRows loop
--
if Get_Group_Char_Cell('MultSelectionRecGrp.BtnNO',i) = 31 then 
--Employee JOinig Date 
JoinDateFromStr := Get_Group_Char_Cell('MultSelectionRecGrp.ID', i) ; --FRM DATE
--Employee JOinig Date 
JoinDateToStr := Get_Group_Char_Cell('MultSelectionRecGrp.DESCR', i) ; --TO DATE
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' JOININGDATE between '||''''||to_date(JoinDateFromStr,'DD-MM-RRRR')||''''||' and '||''''||to_date(JoinDateToStr,'DD-MM-RRRR')||''''||' OR ' ;
end if ;
--
end loop ;
:CrieTeria.QueryString := RTRIM(:CrieTeria.QueryString,' OR ') ;
--
end if ; -- if :CrieTeria.DateOfBirthFrom is not null then
------------end--of----joining---date-----------------------------------------------------
if :CrieTeria.JoiningDateFrom is not null then
--
--if user has selected employeen's TaxNo to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and JOININGDATE between '||''''||to_date(:CrieTeria.JoiningDateFrom,'DD-MON-RRRR')||''''||' and '||''''||to_date(:CrieTeria.JoiningDateTo,'DD-MON-RRRR')||'''' ;
--
end if ; -- if :CrieTeria.JoiningDateFrom is not null then
--
if :CrieTeria.PraId is not null 
or EmpPrAreaNoStr is not null then
--
--if user has selected employeen's Pay Roll Area to search then
--
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EmployeeNo in(select e.employeeno 
from HrmpasEmployee e,
HrmPasEmpPra p ,
HrmOpsPra pr
where p.employeeno = e.EmployeeNo 
and p.Pra = pr.Pra
and p.PlanNo = :CrieTeria.PlanNo
and p.Status = 1
and pr.co = :B0.co
and p.co = :B0.co 
and (pr.PraNo like '||''''||:CrieTeria.PraId||''''||EmpPrAreaNoStr||'))' ; 
--
end if ; --if :CrieTeria.PraNo is not null then
-- 
if :CrieTeria.EmpType is not null 
or EmpTypeNoStr is not null then
--
--if user has selected employee's Type to search then
--
pause ;
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(select e.employeeno 
from HrmpasEmployee e,
HrmPasEmpCont t ,
HrmPasEmpTyp tp 
where t.Employeeno = e.EmployeeNo 
and t.PlanNo = :CrieTeria.PlanNo
and t.PASEMPTYP = tp.PasEmpType
and t.Status = 1
and (tp.EMPTYPE like'||''''||:CrieTeria.EmpType||''''||EmpTypeNoStr||'))' ;
--
end if ; --if :CrieTeria.PasEmpType is not null then
--
if :CrieTeria.EMPNAT is not null 
or EmpStatusNoStr is not null then
--
--if user has selected employee's Nature to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(select e.employeeno 
from HrmpasEmployee e,
HrmPasEmpNatStat N,
HrmPasEmpStat S 
where s.Employeeno = e.EmployeeNo 
and s.PlanNo = :CrieTeria.PlanNo
and s.Co = :B0.co
and n.Type = ''N'' and s.Status = ''A'' 
and s.PASEMPNAT = n.PASEMPNATSTAT
and (n.EMPNATSTAT like'||''''||:CrieTeria.EMPNAT||''''||EmpStatusNoStr||'))' ;
-- message('Values :'||:CrieTeria.PasEmpNat||EmpStatusNoStr);message(' ');
--
end if ; --if :CrieTeria.PasEmpNat is not null then
-- 
if :CrieTeria.EMPSTAT is not null 
or EmpDeploymentNoStr is not null then
--
--if user has selected employee's Deployement to search then
--

:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(select e.employeeno 
from HrmpasEmployee e,
HrmPasEmpNatStat N,
HrmPasEmpStat S 
where s.Employeeno = e.EmployeeNo 
and s.PlanNo = :CrieTeria.PlanNo
and s.Co = :B0.co
and n.Type = ''S''
and s.Status = ''A''
and s.PASEMPSTATUS = n.PASEMPNATSTAT
and (n.EMPNATSTAT like'||''''||:CrieTeria.EMPSTAT||''''||EmpDeploymentNoStr||'))' ;

--
end if ; --if :CrieTeria.PasEmpStat is not null then
-- 
if :CrieTeria.CSTCNTR is not null then
--
--if user has selected employee's CostCenter to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT distinct s.EMPLOYEENO FROM HrmPasEmpOrgStruct s,
HrmOpsPosPlan p,HrmOpsPosCCdtl cd,HrmOpsPosCC cc
where cd.COSTCENTER like '''||:CrieTeria.CSTCNTR||'''
and cc.Status = 1 
and s.Status = 1 
and cd.CcNo = cc.CcNo
and cc.Co = :B0.co
and s.PlanNo = :CrieTeria.PlanNo
and cc.PosPlanNo = p.PosPlanNo
and s.PosNo = p.PosNo )' ;

--
end if ; --if :CrieTeria.CostCenter is not null then
--
if :CrieTeria.ResponsibilityId is not null 
or EmpResponNoStr is not null then
--
--if user has selected employee's Responsibility to search then
-- 
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT s.EmployeeNo
FROM HrmPasEmpOrgStruct s,
HrmOpsPosPlan p,
HrmOpsPosResp r,
HrmOpsRespGroupDtl d,
HRMOPSRESPONSIBILITIES rp
where s.Status = 1
and s.PlanNo = :CrieTeria.PlanNo
and r.PosPlanNo = p.PosPlanNo
and d.RESPGROUPNO = r.RESPGROUPNO
and d.RESPONSIBILITYNO = rp.RESPONSIBILITYNO
and s.PosNo = p.PosNo
and ( rp.RESPONSIBILITYID like '||''''||:CrieTeria.ResponsibilityId||''''||EmpResponNoStr||'))' ;
--
end if ; --if :CrieTeria.ResponsibilityNo is not null then
--
--
if :CrieTeria.QualificationID is not null 
or EmpQualifNoStr is not null then
--
--if user has selected employee's Qualification to search then
--

:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT EmployeeNo
FROM HrmPasEmpQualification eq,
HRMPASQUALIFICATION q
where eq.QualificationNo = q.QualificationNo
and eq.Status = 1 
and ( QualificationID like '||''''||:CrieTeria.QualificationID||''''||EmpQualifNoStr||'))' ; 
--
end if ; --if :CrieTeria.Qualification is not null then
--
if :CrieTeria.QUALLEVEL is not null 
or EmpQualifLevelNoStr is not null then
--
--if user has selected employee's Qualification Level to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT q.EmployeeNo
FROM HrmPasQualificationLvl l,
HrmPasEmpQualification q
where q.Status = 1 
and q.LevelNo = l.LevelNo
and ( l.LEVELID like '||''''||:CrieTeria.QUALLEVEL||''''||EmpQualifLevelNoStr||'))' ; 

--
end if ; --if :CrieTeria.QualificationLvlNo is not null then
--
if :CrieTeria.ExperienceId is not null 
or EmpExperienceNoStr is not null then
--
--if user has selected employee's Experience to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT EmployeeNo
FROM HrmPasEmpExp ex,
HrmPasExp e
where ex.ExpNo = e.ExpNo 
and ( EXPID like '||''''||:CrieTeria.ExperienceId||''''||EmpExperienceNoStr||'))' ; 

--
end if ; --if :CrieTeria.ExpNo is not null then
--
if :CrieTeria.EXPLEVELID is not null 
or EmpExperienceLevNoStr is not null then
--
--if user has selected employee's Experience Level to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT x.EmployeeNo
FROM HrmPasExpLvl l,
HrmPasEmpExp x
where x.LevelNo = l.LevelNo
and ( LEVELID like '||''''||:CrieTeria.EXPLEVELID||''''||EmpExperienceLevNoStr||'))' ; 

end if ; --if :CrieTeria.ExpLvlNo is not null then
--
if :CrieTeria.SkillID is not null 
or EmpSkillNoStr is not null then
--
--if user has selected employee's Skill to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT EmployeeNo
FROM HrmPasEmpSkill es,
HRMPASSKILL s
where s.Status = 1
and es.SkillNo = s.SkillNo
and ( SkillID like '||''''||:CrieTeria.SkillID||''''||EmpSkillNoStr||'))' ; 

end if ; --if :CrieTeria.SkillNo is not null then
--
if :CrieTeria.SKILLLEVEL is not null 
or EmpSkillLevelNoStr is not null then
--
--if user has selected employee's Experience Level to search then
--
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT s.EmployeeNo
FROM HrmPasSkillLvl l,
HrmPasEmpSkill s
where s.Status = 1
and s.LevelNo = l.LevelNo
and ( LEVELID like '||''''||:CrieTeria.SKILLLEVEL||''''||EmpSkillLevelNoStr||'))' ; 
--
end if ; --if :CrieTeria.SkilllevelNo is not null then
--
if :CrieTeria.COMPETENCYID is not null
or EmpComptncyNoStr is not null then
--
--if user has selected employee's Competency to search then
-- 
:CrieTeria.QueryString := :CrieTeria.QueryString|| ' and EMPLOYEENO in(SELECT EmployeeNo
FROM HrmPasEmpCompetency cy,
HrmPesComp c
where cy.PESCOMP = c.PESCOMP 
and cy.Status = 1 
and cy.PlanNo = :CrieTeria.PlanNo 
and ( COMP like '||''''||:CrieTeria.COMPETENCYID||''''||EmpComptncyNoStr||'))' ; 

--
end if ; --if :CrieTeria.PesComp is not null then
--

------------------------HrmPasEmpOrgSstruct---------------------------------------------- 
if :CrieTeria.OuId is not null 
or EmpOUNoStr is not null then
--
--if user has selected employeen's org unit no to search then
--
:CrieTeria.QueryStringForOrgStruct := :CrieTeria.QueryStringForOrgStruct|| ' and t.OrgUnitNo in( Select OrgUnitNo from HrmOpsOrgUnit where OrgUnitId like '||''''||:CrieTeria.Ouid||''''||EmpOUNoStr||')' ; 
--
end if ; --if :CrieTeria.OuNo is not null then
--
if :CrieTeria.JobId is not null 
or EmpJobNoStr is not null then
--
--if user has selected employeen's job no to search then
--
:CrieTeria.QueryStringForOrgStruct := :CrieTeria.QueryStringForOrgStruct|| ' and t.JobNo in( Select JobNo from HrmOpsJOb where JObId like '||''''||:CrieTeria.JobId||''''||EmpJobNoStr||')' ; 
--
end if ; -- if :CrieTeria.JobNo is not null then
--
if :CrieTeria.Posid is not null 
or EmpPosNoStr is not null then
--
--if user has selected employeen's position no to search then
--
:CrieTeria.QueryStringForOrgStruct := :CrieTeria.QueryStringForOrgStruct|| ' and t.PosNo in( Select PosNo from HrmOpsPos where Posid like '||''''||:CrieTeria.PosId||''''||EmpPosNoStr||')' ;
-- --
end if ; -- if :CrieTeria.PosNo is not null then
--
-------------------------PasEmpEpstruct------------------------------------
--
--This 'QueryStringForEmpEpStruct' will set the whare clause with HrmPasEmpEpStruct.
--
if :CrieTeria.GroupId is not null 
or EmpGrpNoStr is not null then
--
--if user has selected employeen's Group no to search then
-- 
:CrieTeria.QueryStringForEmpEpStruct := :CrieTeria.QueryStringForEmpEpStruct|| ' and ep.GroupNo in( Select GroupNo from HrmPasGroupMaster where GROUPID like '||''''||:CrieTeria.GroupId||''''||EmpGrpNoStr||')' ;
--
end if ; -- if :CrieTeria.GroupNo is not null 
--
if :CrieTeria.PAID is not null 
or EmpPaNoStr is not null then
--
--if user has selected employeen's Personnal area to search then
--
:CrieTeria.QueryStringForEmpEpStruct := :CrieTeria.QueryStringForEmpEpStruct|| ' and ep.PaNo in( Select PaNo from HrmOpsPa where PAID like '||''''||:CrieTeria.PaId||''''||EmpPaNoStr||')' ;
--
end if ; -- if :CrieTeria.PaNo is not null 
--
if :CrieTeria.BaID is not null 
or EmpBAreaNoStr is not null then 
--
--if user has selected employeen's Business area to search then
--
:CrieTeria.QueryStringForEmpEpStruct := :CrieTeria.QueryStringForEmpEpStruct|| ' and ep.BaNo in( Select BaNo from HrmOpsBa where BaID like '||''''||:CrieTeria.BaId||''''||EmpBAreaNoStr||')' ;
--
end if ; -- if :CrieTeria.BaNo is not null then
--
-------------------------PasEmpEmpTma------------------------------------
-- 
if :CrieTeria.TmaNo is not null 
or EmpTmaNoStr is not null then
--
--if user has selected employeen's Time management area to search then
--
:CrieTeria.QueryStringForTma := :CrieTeria.QueryStringForTma|| ' and tm.TmaNo in( Select TmaNo from HrmOpsTma where TmaID like '||''''||:CrieTeria.TmaId||''''||EmpTmaNoStr||')' ;
--
end if ; -- if :CrieTeria.BaNo is not null then
--
-- 
------------------------------------------------------------------------------------------------------
--Note *** Following code will finally make the whole where clause and set it to Hrmpasemployee table.
--If your where clause depends upon HrmPasEmpEpStruct then add it in the if and Or structure.
------------------------------------------------------------------------------------------------------ 
--
--If one of the criteria depends on HrmpasempEpstruct then assign this statement to the main where clause string else do not.
--
if :CrieTeria.GroupID is not null 
or :CrieTeria.PaId is not null 
or :CrieTeria.BaID is not null 
or EmpGrpNoStr is not null 
or EmpPaNoStr is not null 
or EmpBAreaNoStr is not null then
--
:CrieTeria.QueryString := :CrieTeria.QueryString ||:CrieTeria.QueryStringForEmpEpStruct||')' ;
--
end if ;
--
--If one of the criteria depends on HrmPasEmpOrgStruct then assign this query clause to the main where clause 'QueryString' else do no thing.
--
if :CrieTeria.OuID is not null 
or :CrieTeria.Jobid is not null 
or :CrieTeria.PosId is not null 
or EmpOUNoStr is not null 
or EmpJobNoStr is not null 
or EmpPosNoStr is not null then
:CrieTeria.QueryString := :CrieTeria.QueryString ||:CrieTeria.QueryStringForOrgStruct||')' ;
end if ; --if :CrieTeria.OuNo is not null 
--
--
--If one of the criteria depends on HrmpasEmpTma then assign this statement to the main where clause string else do not.
--
if :CrieTeria.TmaId is not null 
or EmpTmaNoStr is not null then
--
:CrieTeria.QueryString := :CrieTeria.QueryString ||:CrieTeria.QueryStringForTma||')' ;
--
end if ;
--Now finally set the default where of HrmPasEmployee block.
:CrieTeria.QueryString := :CrieTeria.QueryString || ' Order By EmployeeId ' ;
Set_block_property('HRMPASEMPLOYEE',default_where, :CrieTeria.QueryString) ; 
go_block('HRMPASEMPLOYEE') ;
execute_query ;


end ;

--

do you cee the query making ??? I posted the 1st form that you can see the criteria fields and guess the query making, Now after that process the data shows in the next canvas(2nd screen in topic). And if none criteria selected then it get's all the records related. And those records are huge (approx 10000). Now i want to display all the records in report. Currently i am saving all records in varchar variable. and pass that variable as parameter in report. now all situation is before you if you fully understand then resolve this issue. Thankyou
Re: how to use updated temptable data in report (merged by CM) [message #454190 is a reply to message #452926] Tue, 04 May 2010 07:07 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
1st off don't PM the code to me, post it in thread where everyone can see it. I'm not the only person who can help you with this after all.
2nd - when posting code please use code tags as I have done - see the orafaq forum guide if you're not sure how.

On to the problem in hand:

The 2nd block (HRMPASEMPLOYEE) - what is it based on? A table?
What are you putting in the varchar2 variable that you pass to the report exctly? A list of IDs?
Re: how to use updated temptable data in report (merged by CM) [message #454191 is a reply to message #454187] Tue, 04 May 2010 07:07 Go to previous messageGo to next message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
cookiemonster wrote on Tue, 04 May 2010 17:28
ramoradba wrote on Tue, 04 May 2010 12:46
It is on the way....
you should have pationce..


"sended" reads like past-tense. Hence I assumed it was already posted.


sriam Smile
Re: how to use updated temptable data in report (merged by CM) [message #454208 is a reply to message #452926] Tue, 04 May 2010 07:54 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
This is show_report procedure when the 1st button on the second screen.
PROCEDURE show_report IS

VEmpid  varchar2(32000);
VEmpid1  varchar2(32000);


PLISTID paramlist;
Path    varchar2(300);
Recs		number :=0;

	RgName  VARCHAR2(40) := 'SelectedEmps' ; 
	  RgId    RecordGroup ; 
	  GcId    GroupColumn ; 
	  RecCounter number := 1 ;
	  
			


cursor c1 is
	select p.Descr
	  from MmsProgName b, MmsPath p
	 where b.ProgName = 'PAS820'
	   and b.Type     = 'R'
	   and p.Co       = :B0.Co
	   and b.Path     = p.Path
	   and b.Co       = p.Co ;
	   
	   
	   
BEGIN
	open c1;
	fetch c1 into Path;
	close c1;
	
	/*++++++++++++++++++++++++++++++*/
/*	RgId := Find_Group(RgName); 
	go_block('HRMPASEMPLOYEE');
	First_record ;	
	
	if Not Id_Null(rgid) then
		delete_group(rgid) ;
	end if ;
	--

	 	RgId := Create_Group(RgName, GLOBAL_SCOPE);
	 	GcId := Add_Group_Column(RgId, 'EmpNo', NUMBER_COLUMN); 
	 	  	 	
	  	 	Loop
	
	  	 			 	 Add_Group_Row( RgId, RecCounter) ;
				 	 		 Set_Group_Number_Cell(GcId, RecCounter,:HrmPasEmployee.EMPLOYEENO) ;
				 	 		 RecCounter :=  RecCounter + 1;
													
			exit when :System.Last_record = 'TRUE' ;
			next_record ;  		  	  	 	 					
	  
		 	end loop ;
	
	*/
	
	/*++++++++++++++++++++++++++++++*/
	
	--
	:B0.VEmpid := null;
	
	go_block('HRMPASEMPLOYEE');
	
	first_record;
	loop -- to get the primary key of hrmpasemployees
		:B0.VEmpid := :B0.VEmpid||','||:HrmPasEmployee.EMPLOYEENO;
		Recs := Recs+1;
		exit when :system.LAST_RECORD = 'TRUE';
		next_record;
	end loop;	
	
	
	
	:B0.VEmpid := substr(:B0.VEmpid,2,length(:B0.VEmpid)); -- first is comma to eliminate it
	
	if Recs > 1000 then 
	
	--to get first 1000 employees
	
	VEmpid:=	SUBSTR(:B0.VEmpid,1,INSTR(:B0.VEmpid, ',', 1, 1000)-1);
	
	VEmpid := 'and employeeno in'||'('||VEmpid||')'; -- passing to lexical parameter
		
	--
	-- to get employees next to 1000 
		 
	VEmpid1:=	SUBSTR(:B0.VEmpid,INSTR(:B0.VEmpid, ',', 1,1000)+1,length(:B0.VEmpid));
	
	VEmpid1 := 'or employeeno in'||'('||VEmpid1||')'; -- passing to lexical parameter
	
	elsif Recs = 1000 then
		
	VEmpid:=	SUBSTR(:B0.VEmpid,1,INSTR(:B0.VEmpid, ',', 1, 1000)-1);
	
	VEmpid := 'and employeeno in'||'('||VEmpid||')'; -- passing to lexical parameter	
	
	VEmpid1 := 'or employeeno is null';
	
	elsif Recs < 1000 then
	
	VEmpid:=	SUBSTR(:B0.VEmpid,1,length(:B0.VEmpid));
	
	VEmpid := 'and employeeno in'||'('||VEmpid||')'; -- passing to lexical parameter	
	
	VEmpid1 := 'or employeeno is null' ;
	
	end if;	
	
 PListId := get_parameter_list('Details') ; 

 if not id_null(PListId) then 
		destroy_parameter_list(PListId) ;  
 end if ;   /* not id_null(PListId) then   */


 PListID := create_parameter_list('Details') ;
  
	Add_Parameter(PListID, 'PARAMFORM', TEXT_PARAMETER, 'no');
	add_Parameter(PListID, 'P_CO', text_parameter, :B0.Co) ;
  Add_Parameter(PListID, 'LPATH', text_parameter, :Global.IconPath||'Bestway.gif') ;
  Add_Parameter(PListID, 'EMPNO', TEXT_PARAMETER, VEmpid);
	Add_Parameter(PListID, 'EMPNO1', TEXT_PARAMETER,VEmpid1);	
	

  Run_Product(REPORTS, Path||'pas820.rep', ASYNCHRONOUS, RUNTIME, FILESYSTEM, PListID, NULL);
  
  
END;
Re: how to use updated temptable data in report (merged by CM) [message #454217 is a reply to message #452926] Tue, 04 May 2010 08:01 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
So you are looping over the 2nd block and getting the list of IDs for all the records in the block.

So all you need to do is:
1) Insert those IDs and a session_identifier into a permanent table with the structure I outlined above.
2) Pass the session_indentifier to the report.
3) Modify the report query so that it joins the employee table to the new table in the manner I showed above.

That's it.

The complicated code you use to populate the 2nd block in the first place is irrelevant. All you need to do is capture the list of IDs from the 2nd block.
Re: how to use updated temptable data in report (merged by CM) [message #454316 is a reply to message #452926] Wed, 05 May 2010 01:14 Go to previous messageGo to next message
bl4ckc0der
Messages: 20
Registered: April 2010
Location: Pakistan
Junior Member
I fully following this procedure now, But little bit confused about how to get current session id of the running form , how can i restict the v$session and v$mystats that it return only the session id of the running instance , My table name is 'TEMPDATA'.
Re: how to use updated temptable data in report (merged by CM) [message #454442 is a reply to message #452926] Wed, 05 May 2010 10:33 Go to previous messageGo to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You can use this:
SELECT USERENV('sessionid') FROM dual;


Or you can use a sequence. It doesn't really matter what you use so long as it uniquely identifies your current session.
Previous Topic: text changed trigger
Next Topic: profiles B/D and Forms 6i
Goto Forum:
  


Current Time: Fri Sep 20 09:43:04 CDT 2024