06-03-2017 11:32 AM - edited 02-03-2024 9:44 PM
Hi Everyone,
I want to create an Input parameter in a way which will prompt the user to enter the value in some predefined description, but in back end it should pass the ID of that filed. I have a field call ERP System; the ERP system can be identified from ID or the name. Currently the users are entering the value using the ERP name. But to restrict the data from table used in view, based on ERP, I am joining using the ERP ID (as the fact and dimension tables doesn't have ERP name).
So my question is, if it is possible to accept ERP name in the front end and filter the table data based on ERP ID by passing the ERP ID internally?
I have WebI reports running on this view, so if I can achieve this from WebI also a fesible solution for me.
Note: I have one ERP Table, which stores the ERP Name and ERP ID column.
One option to reach this is to use a second (hidden) parameter which parameter type is "Derived from procedure/scalar function".
So you have two paramters:Following a dummy example which uses a stored procedure which returns an "id" dependent on a specific text (in that example the values are hard coded but can of course be determined out of a table).
Procedure (consider that the output parameter must also be a string, if another type is required, then the conversion has to be done in the view):
PROCEDURE "MISC"."test.misc.procedures::P_DERIVED_P_MAP_VALUE" ( in i_text nvarchar(100), out e_id nvarchar(4) )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
--DEFAULT SCHEMA <default_schema_name>
READS SQL DATA AS
BEGIN
if :i_text = 'test01' then
e_id := '1';
elseif :i_text = 'test02' then
e_id := '2';
elseif :i_text = 'test03' then
e_id := '3';
else
e_id := '9999';
end if;
END;
ID Parameter:
This is the (hidden) parameter which receives the ID determined by the procedure. You have to map your first "name" parameter to the input parameter of the procedure.
Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am able to get one result set now. But when I am trying to access the Input parameter using a calculated column or putting in an filter, I am getting below error
I tried creating the procedure in sys_bic schema as well. Also, in the procedure I hardcoded come value but the input parameter is not able to pick it. Please help!!
Below is the calculated column expression and error
below is the filter expression and error
I tried removing the first input parameter where the user are expected to put the erp name and hard coded on erp name in PROCEDURE to see if it is picking the result, but no luck.
I tried "GRANT EXECUTE ON SCHEMA", but I don't have the access for it.
I am not sure what I am missing here !!
i just hard coded one string to the output parameter (IP_RDSOURCEID = 'hi') in the procedure. I am able to retrieve this in the input parameter using '$$RDSOURCEID$$'.
But when I am writing the query:
select LONGDESC into IP_SOURCEID from "MISC"."RDSOURCE" where LONGDESC = 'ABC';
It is not returning any data. I am able to call the procedure and get value in sql console.
Am I writing the wrong select statement ?
Hi Florian,
Sorry for replying late. The issue was really weird, when I created the same table in sys_bic schema then also it did not work. So I created a new table in its own schema and loaded the records from the existing schema, it worked. Though I could not figure out the reason of this.
Regards,
Deba
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.