Usinging SQL Functions in a Derived Column
I want to decode values in a column of a sql report. I'm thinking of using a derived item but what is the code (in the HTML Expression field)?. Is this the correct place to do this? The only other way to do this,I believe is in the SQL Definition directly.
Paul Platt
Hi Paul,
I don't quite understand what you are trying to do.
Is is just a simple decode in a sql report or something more?
If it's just a simple decode what is it that's not working?
Similar Messages
-
How can I implement an user function in a derived column of a report ?
Hello,
I've a report and added a derived column.
In this column should be displayed the result of a function.
GETANZGJMONATE ( to_date(#START_AFA#,'DD.MM.YYYY'), #ND#, :P302_GJ );
How can I implement this?
Thanks in advance
Regards UlrikeUlrike - I would do this in the SQL statement (there may be other ways).
Presumably START_AFA and ND are table columns?
Presumably you've also created the GETANZGJMONATE function?
So, something like this should work (this also assumes that START_AFA is of a DATE type - you'll need the TO_DATE call if not):
SELECT COL1
, COL2
, START_AFA
, ND
, GETANZGJMONATE (START_AFA, ND, :P302_GJ)
from TABLE
where ...
Can't remember if you have to grant any particular execute permissions on the function ('grant execute on GETANZGJMONATE to public', for example) when you call it from SQL on a page, but you could try that if the function call fails.
Depending on what's in :P302_GJ and what the function parameter data type is, you might need to use the '&P302_GJ.' syntax or TO_NUMBER etc.
Hope this helps.
Regards,
John. -
Passing #COLUMN_VALUE# as parameter to pl/sql function in column template
Hi all,
I want to color negative amounts in red in sql report using column template.
I created a pl/sql function"isNegativeNum" which returns 1 or -1.
create or replace function isNegativeNum(p_column_value varchar2) return number
as
l_dummy number;
begin
l_dummy := to_number(p_column_value,'999G999G990D00PR');
IF l_dummy < 0
THEN
RETURN 1;
else
return -1;
END IF;
exception
when others then
RETURN -1;
end;Below is column template.
Column Template 1
<td class="t3dataalt" #ALIGNMENT#><p color=red>#COLUMN_VALUE#</p></td>Column Template 1 Condition
isNegativeNum('#COLUMN_VALUE#') = -1The issue is #COLUMN_VALUE# value is not being passed to the function, Insert statement in function reveals p_column_value as a string "#COLUMN_VALUE#". When I try without quotes like isNegativeNum(#COLUMN_VALUE#) = -1, I get below error.
ORA-06550: line 1, column 48: PLS-00103: Encountered the symbol "#" when expecting one of the following: ( ) - + case mod new not null others select table avg count current exists max min prior sql stddev sum variance execute multiset the both leading trailing forall merge year month DAY_ hour minute second timezone_hour timezone_minute timezone_region timezone_abbr time timestamp interval date
Error ERR-1025 Error processing PLSQL expression. isNegativeNum(#COLUMN_VALUE#) = 1
Any help is appreciated.
KishoreHi Kishore,
using #COLUMN_VALUE# would probably not make much sense, because normally a report has multiple columns and not just the numeric column which you want to verify if it's negative. But APEX will fire the template condition for each column, because the report template is a column cell template.
What you can do to make it more generic is to use for example
#CHECK_AMOUNT#
in the template and provide a not displayed column in your SQL statement which contains your value which is named CHECK_AMOUNT. For example:
SELECT NAME
, BALANCE
, BALANCE AS CHECK_AMOUNT
FROM XXX;Because this CHECK_AMOUNT column would be a generic name, you can use this template in all your reports as long as you provide this column.
Thope that helps
Patrick -
Column order in SQL Query (PL/SQL function returning a query)
Hi,
when I define a PL/SQL function returning a query inside a region, I often find that the column order is arbitrarily changed.
How do I enforce the column order ?
Bye,
FlavioI removed the 11th column called service_name from this dynamic query: and now the report says: report error:
ORA-01403: no data found. I messed around with the Headiuns Type. It was set to Custom. I changed it to Column Names. There is no difference.
I am not sure how to fix?
declare topqry varchar2(32000);
whereqry varchar2(32000);
finalqry varchar2(32000);
var_status varchar2(100);
division_status varchar2(50);
office_status varchar2(1000);
user_status varchar2(1000);
overdue_status varchar2(1000);
begin
if :P10_FALLBACK = 'All' then
var_status:= ' and vp.status in (''FA'',''FBA'',''FBI'',''25%'',''50%'',''90%'',''Closed'') ';
elsif :P10_FALLBACK = 'Active' then
var_status:= ' and vp.status in (''FA'',''25%'',''50%'',''90%'',''FBA'') ';
elsif :P10_FALLBACK = 'FB' then
var_status:= ' and vp.status in (''FBA'',''FBI'') ';
elsif :P10_FALLBACK = 'Closed' then
var_status:= ' and vp.status in (''Closed'') ';
elsif :P10_FALLBACK = 'Inactive' then
var_status:= ' and vp.status in (''FBI'') ';
end if;
if :P10_DIVISION = 'All' then
division_status:= ' and vp.vms_division in (''News'',''Ad Services'') ';
elsif :P10_DIVISION = 'News' then
division_status:= ' and vp.vms_division in (''News'') ';
elsif :P10_DIVISION = 'Ad' then
division_status:= ' and vp.vms_division in (''Ad Services'') ';
end if;
if :P10_OFFICE = '%' then
office_status:= ' and OFFICE_ID in (select office
from VMS_OFFICE_ACCESS
where user_id = lower(:P0_user) ) ';
else
office_status:= ' and OFFICE_ID in :P10_OFFICE ';
end if;
if :P10_LIMIT_USER = '%' then
user_status := ' and SALESPERSON in (select first_name || '' '' || last_name
from VMS_PROSPECT_users u
join vms_office_access o
on u.office_id = OFFICE
where o.user_id = lower(:P0_USER) ) ';
else
user_status:= ' and SALESPERSON in (:P10_LIMIT_USER ) ';
end if;
if :P10_SHOW_OVERDUE = 'Show' then
overdue_status:= ' and target_close_date <= sysdate ';
var_status:= ' and vp.status in (''25%'',''50%'',''90%'',''FBA'') ';
else
overdue_status:= ' and FIRST_APPOINTMENT between
nvl(to_date(:P10_FIRST_APPT_START, ''mm/dd/yyyy''),FIRST_APPOINTMENT) and
nvl(to_date(:P10_FIRST_APPT_END,''mm/dd/yyyy''),FIRST_APPOINTMENT) ';
end if;
topqry := 'SELECT OFFICE_ID ,vp.PROSPECT_ID ,ENTRY_DATE ,ACCOUNT , NEXT_CONTACT_DATE ,ACTION_STEP ,
TARGET_CLOSE_DATE ,vp.STATUS ,SALESPERSON ,vp.SALES_TYPE ,service_name , FIRST_APPOINTMENT ,MODIFY_DATE ,EST_ANNUAL_REVENUE ,EST_INCREMENTAL_REVENUE ,
pi.NOTES , pi.SALES_TYPE ,pi.STATUS ,Contact ,Origin_Source FROM VMS_PROSPECTING_ITEMS pi right outer join VMS_PROSPECTS vp on vp.PROSPECT_ID = pi.PROSPECT_ID left outer join VMS_SERVICES vs on vs.service_ID = pi.service_ID where 1 = 1 ';
whereqry := ' and (not exists (select *
from VMS_PROSPECTING_ITEMS i3
where vp.prospect_id = i3.prospect_id)
or exists (select *
from VMS_PROSPECTING_ITEMS i2
where i2.order_id = pi.order_id
and active = ''Y'' )) and instr(upper(ACCOUNT),upper(nvl(:P10_ACCOUNT,ACCOUNT))) > 0 ';
whereqry := whereqry || var_status || division_status || office_status || user_status || overdue_status;
finalqry := topqry || whereqry;
return finalqry ;
end; -
How to call PL/SQL function inside column in entity
Hello,
How can I do next:
- Crete entity from existing table in database, but one column in the table gets value from function. Function is written in oracle PL/SQL language and it is located inside some package on database.
Application should run LCDS3 and tomcat.
All help is appricitatedAnil,
I'm using LCDS3, and here is what I trying to do (for example):
- I have on Oracle DB table REGION, with columns: Code, State, Population.
- I want to create entity that contains same columns as table REGION (Code, State, Population) and to have addition column RegionName witch get value from PL/SQL function (loacated in package "common" on DB) "common.fgetRegionName(Code)".
Can you explain me how to create that entity.
Thanks
Almir -
SQL function column in drop down list's data provider's query
Just wondering, if it is somehow possible to use SQL function column for drop down list through data provider.
At the moment, I am using id column as return value and name as display value from this query through CachedRowSetDataProvider:
SELECT ALL someTable.Id,
someTable.Name,
someTable.Postal_Code,
FROM someTable
However, I want to change display to use calculated column as display value, for example Name_PostalCode from below mentioned changed query:
SELECT ALL someTable.Id,
CONCAT(someTable.Name, ' - Pin Code: ',someTable.Postal_Code) Name_PostalCode ,
someTable.Name,
someTable.Postal_Code,
FROM someTable
But JSC doesn't seem to like this.
Is it someway possible to achieve this?
Thanks.>
But JSC doesn't seem to like this. Can you explain more. When doesn't it like it, in the design view, in the query editor, when your run it? What is the error you are seeing?
See http://blogs.sun.com/divas/entry/displaying_multiple_fields_in_a -
Convert SQL Query to Derived Column Expression
I'm in the process of reworking some SSIS packages I inherited. A lot of these use Execute SQL Statement components to update certain fields in the tables once they've been loaded. I'd like to replace these individual UPDATE statements with Derived Column
components.
I've got 95% of them converted, except for a couple, one of which has me a bit perplexed and was hoping someone could provide some insight.
Essentially, there is a column called POSTPERIOD which is a date in string format YYYYMM (i.e., 201503). The SQL update parses out the month piece and converts it to the month name and populates a column called POSTPERIOD_MONTH.
Here is the SQL:
select DateName(month , DateAdd(month, CONVERT(INT, SUBSTRING(POST_PERIOD,5,2)), 0 ) - 1 )
I'd like to accomplish this using a Derived Column, but not sure how to go about doing this...
If someone could point me in the right direction, it would be greatly appreciated!
Thanks!
A. M. RobinsonVisakh:
Thank you for the reply! I've tried your solution but am getting the following error(s):
Warning 17 Validation warning. Populate STAGING_DIM_AP_DETAIL - RADIO: {ACAA99C4-272C-4641-BF44-B4D4409D1EFB}: The expression "(DT_STR,8,1252)((DT_I4)[SUBSTRING](#85,5,2) == 1 ? (DT_STR,8,1252)"January" : ((DT_I4)[SUBSTRING](#85,5,2)
== 2 ? (DT_STR,8,1252)"February" : ((DT_I4)[SUBSTRING](#85,5,2) == 3 ? (DT_STR,8,1252)"March" : ((DT_I4)[SUBSTRING](#85,5,2) == 4 ? (DT_STR,8,1252)"April" : ((DT_I4)[SUBSTRING](#85,5,2) == 5 ? (DT_STR,8,1252)"May" :
((DT_I4)[SUBSTRING](#85,5,2) == 6 ? (DT_STR,8,1252)"June" : ((DT_I4)[SUBSTRING](#85,5,2) == 7 ? (DT_STR,8,1252)"July" : ((DT_I4)[SUBSTRING](#85,5,2) == 8 ? (DT_STR,8,1252)"August" : ((DT_I4)[SUBSTRING](#85,5,2) == 9 ? (DT_STR,8,1252)"September"
: ((DT_I4)[SUBSTRING](#85,5,2) == 10 ? (DT_STR,8,1252)"October" : ((DT_I4)[SUBSTRING](#85,5,2) == 11 ? (DT_STR,8,1252)"November" : (DT_STR,8,1252)"December")))))))))))" will always result in a truncation of data. The expression
contains a static truncation (the truncation of a fixed value). Dimension Finance - Load STAGING_DIM_AP_DETAIL_DERIVED_COLUMNS.dtsx 0 0
This is the derived column expression I'm using:
(DT_STR,8,1252) ((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 1? (DT_STR,8,1252) "January" : ((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 2 ? (DT_STR,8,1252) "February" : ((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 3 ? (DT_STR,8,1252) "March" :((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 4 ? (DT_STR,8,1252) "April":((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 5 ? (DT_STR,8,1252) "May" : ((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 6 ? (DT_STR,8,1252) "June" : ((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 7 ? (DT_STR,8,1252) "July" : ((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 8 ? (DT_STR,8,1252) "August":((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 9 ? (DT_STR,8,1252) "September":((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 10? (DT_STR,8,1252) "October": ((DT_I4)SUBSTRING([POST_PERIOD],5,2) == 11 ? (DT_STR,8,1252) "November" : (DT_STR,8,1252)"December")))))))))))
Some info that might be of some help in the matter...the POST_PERIOD field is a VARCHAR(8), the POST_PERIOD_MONTH field is also a VARCHAR(8).
There is a computed column Any help would be appreciated once again!!!
A. M. Robinson -
Materialized View with column based on PL/SQL function returning object
I have the following problem - it is known that materialized view wants PL/SQL functions used in it to be DETERMINISTIC. And it appears that a function which returns SDO_GEOMETRY cannot be DETERMINISTIC - I can add DETERMINISTIC modifier to my function which returns sdo_geometry based on USNG grid ID and save the package, and it compiles and runs fine with regular queries, but when it comes to materialized view (mview), the following error is thrown:
ORA-12018: following error encountered during code generation for "SCHEMA"."MVIEW_NAME"
ORA-00932: inconsistent datatypes: expected NUMBER got MDSYS.SDO_GEOMETRY
Looks like DETERMINISTIC modifier is not fully supported for object types. I have tried to use SDO_CS.FROM_USNG Oracle's function, and it appeared that this function is also non-deterministic - I cannot refresh mview with P or F on-demand refresh method (see http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14223/refresh.htm#i1008349 for a list of on-demand refresh methods). Without that function I can refresh mview with P or F flags.Hi,
Yes, the Chart Series can be based on "Function Returing SQL Query" and the "SQL" would be something like:
DECLARE
vSQL VARCHAR2(1000);
BEGIN
vSQL := 'SELECT NULL LINK, ENAME LABEL, SAL VALUE FROM EMP ORDER BY ENAME';
RETURN vSQL;
END;You should tick the "Save query without validation" underneath that. Without this, there is a validation error - the ; at the end is required to get the chart to function correctly but the validator sees this as an error.
You would need to create this separately from the report. No matter how you did it, the chart would still run a SQL statement to generate the output. If you wanted to use the "same data", then you could create a collection using the PL/SQL and base both the report and the chart on the collection instead.
Andy -
Hi All,
I am trying to create ETL using store procedure .
Please helo me to create derived column in qyery
add columns
TimeIn =GETDATE()
BBxKey =100
LatestVersion=1
Thanks in Advance
Regards,
Vipin jha
Thankx & regards, Vipin jha MCPHi Vipin,
Are you use a variable as the OLE DB Source, so the source table is dynamic based on the variable value? If in this scenario, we can use the expression like below for the derived column BBxKey:
@[User::source]=="A"?Substring(Col001,1,7): @[User::source]=="B"?(Substring(Col001,1,7)
+Substring(Col002,1,10)): @[User::source]=="C"?Substring(Col002,1,7): ""
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
SSIS function inside derived column !!
HI Friends My Source csv files has one column has below rows:
counts
1
12
13
12/10
13/13
my destination col datatype is FLOAT, which rows has numerator and denaminator. i want only numerator. I don't want '/10'.
how can i write ssis function inside the derrived column ! thanks in advance.LEFT((DT_STR,10,1252) COUNT + (DT_STR,2,1252) "//",FINDSTRING(COUNT,"/",1)-1)
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Subquery not allowed - PL/SQL Function Body returning bolean
Is subquery is not allowed in PL/SQL Expresion.????
I am using the following query in one of my derived report column but I am getting the error.
BEGIN
if :COL1<>'abc' and :COL2 in (select deptno from dept1) then
return 1;
elsif :COL1<>'abc' and :COL2 in (select deptno from dept2) then
return 0;
elsif :COL1<>'abc' and :COL2 in (select deptno from dept3) then
return 1;
else
return 0;
end if;
END;
secondly CAN I use return value such as 'ABC' or 'XYZ' other than 0,1.
Error-
Invalid function body condition: ORA-06550: line 4, column 8: PLS-00405: subquery not allowed in this context ORA-06550: line 2, column 3: PL/SQL: Statement ignored
-----------------Hi Deepak,
There are at least methods.
1 - You could create a SQL function that returned 0 or 1 and use that in your statement
2 - You could use a CASE clause in the SQL statement
As I don't have your dept1/2/3 tables, I've tried the following on the sample EMP/DEPT tables:
SELECT EMPNO,
ENAME,
SAL,
COMM,
DEPTNO,
CASE WHEN DEPTNO IN (SELECT DEPTNO FROM DEPT) THEN
CASE WHEN ENAME LIKE '%A%' THEN NVL(SAL,0) + NVL(COMM,0) ELSE 456 END
ELSE
CASE WHEN DEPTNO NOT IN (SELECT DEPTNO FROM DEPT) THEN
CASE WHEN ENAME LIKE '%A%' THEN NVL(SAL,0) + NVL(COMM,0) ELSE 123 END
ELSE
789
END
END "TOTAL"
FROM EMPThis returns the values I expect:
EMPNO ENAME SAL COMM DEPTNO TOTAL
7936 ATD 3000 - 40 3000
7958 dino4 - - - 789
7839 KINGS 5000 - 40 456
7698 BLAKES 2850 - 30 2850
7782 CLARK 2450 - 10 2450
7566 JONES 2975 - 30 456
7788 SCOTT 3000 - 20 456
7902 FORD 3000 - 40 456
7369 SMITH 800 - 20 456
7499 ALLEN 1600 300 30 1900Obviously, you may have to experiment with the various CASE statements, but it will work using just a sql select statement.
Andy -
SSIS: Using CASE Statement Within A Derived Column Transformation Expression
The following is my Data Flow:
Ole DB Source > Copy Column > Derived Column >Ole DB Command
My OLE DB Source has the following SQL command task:
SELECT *
FROM Repair R
LEFT OUTER JOIN Vehicle V
ON R.SN = V.SN
AND R.Reg = V.Reg
LEFT OUTER JOIN Product P
ON R.PID = P.PID
This yields a column of concern for me named PartNumber, which are represented by the following 2 formats:
The following are my Copied Columns:
Input Column = PartNumber
Output Alias = Copy of PartNumber
The following are my Derived Column expressions:
Derived Column Name Derived Column Expression
Name Replace 'PartNumber' LEFT(PartNumber,FINDSTRING(PartNumber,"-",1) - 1)
Copy of Name Replace 'Copy of PartNumber' RIGHT([Copy of PartNumber],LEN([Copy of PartNumber]) - FINDSTRING([Copy of PartNumber],"-",1))
So My PartNumber Column is Replaced with ######### of type
string and the Copy of PartNumber column is replaced with
#### of type int
As I stated earlier PartNumber also is in the format of %-%-% which raises the following question:
How can I replace PartNumber Column with NULL if in format of
%-%-% and take the PartNumber and put it in new column named
SubPart while keeping all the logic within SSIS objects?
So in essence I want to do something like the following:
PartNumber = CASE
WHEN 'PartNumber' LIKE '%-%-%'
THEN ABC = PartNumber AND PartNumber IS NULL
END
I have tried the case statement in a Derived Column expression and is not working. Would I add the
CASE statement to the SQL command task in my OLE DB Source?
I hope this question is concise for you.If it must be in SSIS, I would put a derived column stage earlier in the process to do my check for me. Then in the second derived column stage do the check against each output column (part, subpart, copy of part) to decide which way it goes
PS Not sure if it's a 2012 function but SSIS has a function called TOKEN that will allow you to pull your subparts for you rather than the left/right you are doing -
Finding correlation using derived columns?
I want to use the aggregate CORR_S function which take two numerical columns and output the correlation between them. Assuming I have the table:
Employee(name, gender, salary) where I want to create two derived columns, how would I do it?
Like,
SELECT CORR_S(
SELECT salary
FROM employees
WHERE salary < 10000,
SELECT salary
FROM employees
WHERE salary > 10000
) as correlation
FROM employees
It will find the correlation between salary's less than $10,000 in one column and salary's more than $10,000 in another column. Of course, I get an error when running the query. It's no problem if I use CORR_S(salary, salary) but I want to use derived columns, is it possible? Or, will I need to create a new table view with two new columns CORR_S(lowSalary, highSalary)?
Thanks.It may be correct sql query, but statistically ( i mean here the OP question, or at least how i interpret it) it is nonsense.
Clearly , correlation show how good distribution of one set of items corresponds to another set, so the order of item in the itemset does matter. Consider
SQL> WITH t AS (
2 SELECT 1 id1, 10 id2, 30 id3 FROM dual UNION ALL
3 SELECT 2 , 20 , 10 FROM dual UNION ALL
4 SELECT 3 , 30 , 20 FROM dual )
5 SELECT corr_s(id1,id2), corr_s(id1,id3)
6 FROM t
7 /
CORR_S(ID1,ID2) CORR_S(ID1,ID3)
1 -.5So, it would make sense to calculate correlation between salary and hiredate, salary and department number, salary and employee name's length, whatever, but how can be correlated salary less 10k to salary more than 10k - i can't understand it. They are not in the same set, but in two different sets ( while one can have either more 10k or less 10k, but not both) and relation between these two sets is not given by OP.
Best regards
Maxim -
Derived column dot showing in CSV
Hi, I have a derived column.
When I unabled the report so it downloads the data into a spreadsheet,
I see that it's showing all the column headings but not tha value.
Is there a way to fix it so it also shows the values of the derived columns in CSV?
Thanks,Hi,
I had a similar problem. As I understand it, the csv export function re-runs the SQL statement and produces the output based on that rather than the contents of your report (which is why, for instance, you get all of the data even though your report may be paginated).
The only solution, which I had to use, was to change the SQL statement to include the derived values rather than create them on the report definition.
Regards,
Andy -
I'm getting the following error when I try to add a derived column or a link to a report region having a type of PL/SQL Function Body Returning SQL Query)
failed to parse SQL query:
ORA-00904: "COL60": invalid identifier
Any ideas?
Thanks
DavidDavid,
Youâre using generic column names. This setting generates 60 generic columns, and 60 columns is the maximum number of columns allowed. Adding a derived column or link column exceeds that number. So these types of column canât be used with generic column based reports. Try enabling the âuse query specific column namesâ option when editing your report source. This type of report would allow adding link columns and derived columns.
Regards,
Marc
Maybe you are looking for
-
Search bar in save as dialog box
I just updated to windows 7 and realized that when I go to save a document I don't have the "search bar" avalable? Is there a way I can get that in the save as UI? Or do I have to manually find my folders on my network?
-
How do i install windows 8.1 onto my iMac late 2013
how do install windows 8.1 onto my late 2013 imac. i have no prior windows uploaded onto my imac and i would like to download windows 8.1 without having all these problems that everyone else is seeming to have.
-
Please help with the Universal Dock issue!!!
Hi, I recently purchased a universal dock for my iphone 3g. It works great. I just had one question. When my iphone is sitting on it for lets say 20 - 30 minutes. Then if i press the buttons on the remote. nothing happens! If I then press the home bu
-
Lightroom 3.6 - folders missing, can't find to reconnect - please help!
Fired up LR this morning and the folders all have the dreaded grey ? next to them. When I try to reconnect however, the data drive does not appear. Please see screenshot below -- it only has Desktop and subfolders showing for selection. I can't ev
-
Hello, I am trying to use message type FIDCCP to create idocs for FI Document posting. However i am unable to see any idocs created. I have configured the system and activated change pointers for FI Documents. My question is does anybody have previou