Based on v$session.state, no session is "ON CPU" ????
Hello all,
v$session.state never equal to "ON CPU", what does it mean ?
No session is on CPU ???
v$session.state values possible = WAITED KNOWN TIME or WAITED SHORT TIME or WAITING
But not "ON CPU", so maybe NEVER any session is on CPU ????
My aim is to sho the "state" of current "ACTIVE" session ( like "waiting", "working"), and I suffer a little because based on v$session ALL SESSIONS are in WAIT !!!!
Thanks in advance.
As Hermant has already pointed out, the "STATE" column in v$session can have 3 values
(a) waiting
(b) waited known time
(c) waited short time
So if you want to have a more appropriate picture of what you sessions are doing then you can use the following query to get what you want
select
decode(state, 'WAITING', event, 'ON CPU')
,count(*)
from v$session
where status = 'ACTIVE'
and username is not null
group by decode(state, 'WAITING', event, 'ON CPU')
order by count(*) desc;
SELECT username
, schemaname
, DECODE (state, 'WAITING', event, 'ON CPU')
, osuser
, machine
, program
, sql_id
, prev_sql_id
, module
, action
,client_info
FROM v$session v
WHERE status = 'ACTIVE'
AND username IS NOT NULL;Best regards
Mohamed Houri
www.hourim.wordpress.com
Similar Messages
-
How to invalidate a session based on the session id
How to invalidate a session based on the session id
You have to write your own support for this.
It used to be in the API, but was deprecated as a security hole.
The best way to do it is implement a session listener (javax.servlet.http.HttpSessionListener) which notifies you when sessions are created/destroyed.
You can then keep a map of sessions in your own code, indexed by session Id, and access any/all of them to invalidate as you choose. -
Exceeded session limit on CPU usage
Hi All,
We are getting message while generating some reports. Pl. see the Error Text below for message. For time being we have bumped the session limit to unlimited to take care of this problem for now. But the question is u201CIs there a way available in MII to refresh(cycle) the Data source connectionu201D So that the DB session limit can be kept un altered?
When we search this on different forums, we got a solution which we aleady implemented(bumping the session limit to unlimited). But we are looking for a solution from MII side.
Any help will be appreciated
Regards,
Rajesh.
Error Text:
Error occurred while processing data stream, A SQL Error has occurred on query, ORA-02392: exceeded session limit on CPU usage, you are being logged off . com.lighthammer.Illuminator.logging.LHException: Error occurred while processing data stream, A SQL Error has occurred on query, ORA-02392: exceeded session limit on CPU usage, you are being logged off . at com.lighthammer.Illuminator.logging.ErrorHandler.handleError(Unknown Source) at com.lighthammer.Illuminator.logging.ErrorHandler.handleError(Unknown Source) at com.lighthammer.Illuminator.connectors.Proxy.Proxy.processRequest(Unknown Source) at com.lighthammer.Illuminator.services.handlers.IlluminatorService.processRequest(Unknown Source) at com.lighthammer.Illuminator.services.ServiceManager.runQuery(Unknown Source) at com.lighthammer.Illuminator.servlet.Illuminator.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.lighthammer.Illuminator.servlet.ServletRunner.run(Unknown Source) at com.lighthammer.Illuminator.servlet.ServletRunner.runAsXmlQuery(Unknown Source) at com.lighthammer.xacute.actions.illuminator.queries.IlluminatorQueryObject.LoadDocument(Unknown Source) at com.lighthammer.xacute.actions.illuminator.queries.IlluminatorQueryObject.Invoke(Unknown Source) at com.lighthammer.xacute.core.Action.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Process(Unknown Source) at com.lighthammer.xacute.core.ActionSequence.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Process(Unknown Source) at com.lighthammer.xacute.core.ActionSequence.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Process(Unknown Source) at com.lighthammer.xacute.core.Conditional.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Process(Unknown Source) at com.lighthammer.xacute.core.ActionSequence.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Process(Unknown Source) at com.lighthammer.xacute.core.ActionSequence.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Process(Unknown Source) at com.lighthammer.xacute.core.ActionSequence.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Process(Unknown Source) at com.lighthammer.xacute.engine.TransactionEngine.Execute(Unknown Source) at com.lighthammer.Illuminator.connectors.Xacute.XacuteRequestHandler.processQueryRequest(Unknown Source) at com.lighthammer.Illuminator.connectors.Xacute.XacuteRequestHandler.QueryRequest(Unknown Source) at com.lighthammer.Illuminator.connectors.Xacute.XacuteConnector.processRequest(Unknown Source) at com.lighthammer.Illuminator.services.handlers.IlluminatorService.processRequest(Unknown Source) at com.lighthammer.Illuminator.services.ServiceManager.runQuery(Unknown Source) at com.lighthammer.Illuminator.servlet.Illuminator.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.newatlanta.servletexec.SERequestDispatcher.forwardServlet(SERequestDispatcher.java:638) at com.newatlanta.servletexec.SERequestDispatcher.forward(SERequestDispatcher.java:236) at com.newatlanta.servletexec.SERequestDispatcher.internalForward(SERequestDispatcher.java:283) at com.newatlanta.servletexec.SEFilterChain.doFilter(SEFilterChain.java:96) at com.lighthammer.cms.system.CMSFilter.doFilter(Unknown Source) at com.newatlanta.servletexec.SEFilterChain.doFilter(SEFilterChain.java:60) at com.newatlanta.servletexec.ApplicationInfo.filterApplRequest(ApplicationInfo.java:2159) at com.newatlanta.servletexec.ApplicationInfo.processApplRequest(ApplicationInfo.java:1823) at com.newatlanta.servletexec.ServerHostInfo.processApplRequest(ServerHostInfo.java:937) at com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1091) at com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:973) at com.newatlanta.servletexec.ServletExecService.processServletRequest(ServletExecService.java:167) at com.newatlanta.servletexec.ServletExecService.Run(ServletExecService.java:204) at com.newatlanta.servletexec.HttpServerRequest.run(HttpServerRequest.java:487)Hi,
Kindly try out the below option from database side.
Error : ORA-02392: exceeded session limit on CPU usage, you are being logged off
Cause : An attempt was made to exceed the maximum CPU usage allowed by the CPU_PER_SESSION clause of the user profile.
Action : If this happens often, ask the database administrator to increase the CPU_PER_SESSION limit of the user profile.
If you looking for solution in MII end,
Check with SAP MII administrator on log files.
Check Data server tab for configuration details. (eg : Pool Size, Pool Max etc)
Kindly let us know the version of SAP MII.
Thanks
Rajesh Sivaprakasam. -
Where is "Display as Text (based on LOV, saves state)"
I am developing an application using the version of HTMLDB that comes with OracleXE.
I have a tabular form, in which the default column for a particular item is sourced from a previously entered item on another page. This is a lookup item and needs to be non-changeable by the user. So I want to use the "Display As" option "Display as Text (based on LOV, saves state)". However, this option is not available in the pull-down for "Display As". The option "Display as Text (based on LOV, does not save state)" is available, but using this option means that the item is not saved to the database.
Does anyone know why the stateful display as option is not available.
Thanks in advance,
RobScott, thanks for the feedback. The problem is that although the value is displayed correctly, it is NOT saved to the database. Effectively, header information is entered in a previous screen, and one of the entered fields is written to each of the detail lines associated with the header. We are re-platforming an existing application (written in an obscure form of basic), and at this stage changing the schema is not an option. So this header item (which is a foreign key to a "store" table), is meant to be written down to each line, on the screen displayed as the store name, and written to the inserted lines as the lookup id. If I use the dispaly as text save state option teh database is updated correctly, but displays the id rather than name on the screen. The only display as lov option i can see is the one that does not save state. If I use this option the screen displays as I want but the database is not updated. I need to use the display as lov saves state option. but i do not see it.
Any ideas?
Thanks for your time.
Rob -
Annoying [ ] with "Display as Text (based on LOV, saves state)"
Hi all,
I've got a form where some items are shown as “Display as Text”. These values are displayed normally.
But I also have some items which are shown as “Display as Text (based on LOV, saves state)”. When I run the page and these items don't return a value (because it isn't filled in in another page), we get the annoying []-sings.
Is there anyone who knows how to fix this, I just want to display nothing when there is no value.I've tried this one already.
I tried to leave it blank, & nbsp ; , text,... but the problem is that our lov is build by a function and it always returns a query, so the LOV is never null.
I figured something out: made a process after header that has some cursors to get the values from the database and changed the item to a simple display as text-field. There were only 4 that were wrong, so it wasn't to much work. -
Cannot see Display as Text (based on lov, saves state)
I have raised this question on the HTMLDB forum (Where is "Display as Text (based on LOV, saves state)" but in case its XE specific I am posting here too.
I have a tabular form in the XE version of HTMLDB, and wish to use the "Display as Text (based on LOV, saves state)" option. However, this option does is not available to me - are there some conditions necessary for this option to be displayed?
Thanks, RobRob,
I doubt it's an XE specific issue. I've asked for more information in the original thread.
Sergio -
Display As Text (based on LOV, saves state) "p_t03" was assigned by APEX
Hi All,
I have an ITEM
Name: P36_INT
Display As: Display As Text (based on LOV, saves state)
Output in my HTML:
[input type="hidden" name="p_t03" value="YES" />[span id="P36_INT">Interior[/span>
'p_t03' was assigned by APEX
In my Javascript I have to access it as the following to get the "YES" value:
var lintObj = html_GetElement('p_t03');
Originally it was 'p_t01' but it changed from 'p_t01' to 'p_t03' somehow.. out of my control.
How do I assign an ID or assign my own name to the "hidden" item?Scott, thanks for the feedback. The problem is that although the value is displayed correctly, it is NOT saved to the database. Effectively, header information is entered in a previous screen, and one of the entered fields is written to each of the detail lines associated with the header. We are re-platforming an existing application (written in an obscure form of basic), and at this stage changing the schema is not an option. So this header item (which is a foreign key to a "store" table), is meant to be written down to each line, on the screen displayed as the store name, and written to the inserted lines as the lookup id. If I use the dispaly as text save state option teh database is updated correctly, but displays the id rather than name on the screen. The only display as lov option i can see is the one that does not save state. If I use this option the screen displays as I want but the database is not updated. I need to use the display as lov saves state option. but i do not see it.
Any ideas?
Thanks for your time.
Rob -
Display as text (based on LOV saves state) : possible border ?
Hi,
Like mentioned in the subject, I have many Display as text (based on LOV saves state). I would like to have a frame or a border around this field eventhough it's read only, like a regular field. How can I do that ?
thank you.Depending on your visual requirements, you could change the items to Text Fields (disabled or not) then simply make the Read-Only atttribute set to "always" or something that would equate to "always". It would look just like a text field (since it would in fact be one), but would be read-only.
Sadly, this would require you to change all your items to the new type which would take time. -
Session based load balance + Prepared statements
Experts,
From the docs I understand that there are 3 load balancing techniques. One is client side and two are server side. Of the two, one is session count based load balancing, and as per docs, it is recommended for connection pool setting.
My question is if I have prepared statements originally created using connection to node1, and say if listener re-directs the conneciton to another node node2, will the prepared statement work on node2 ?.
Thanks
VissuJust to clarify, the question is:
Are the prepared statements usable when we use session count based load balancing. -
SESSION EXPIRED and CPU Utilisation is 100% when called from Pro*C
Dear Colleague
We are having a production system developed using Pro*c and PL/SOL packages in HP Unix.
The system is doing the following,
A file will be decoded using Proc and data will be load into 3 temporary tables (permanent table used for temporary) using SQLLoader. Then it calls a PL/SQL package which will process the data in the temporary tables and will store the summary information in Transaction table and will returns a unique id to the calling Pro*c module. The whole process is completed in a single process/oracle session.
The PL/SQL package, join the 3 Temporary tables and retrieve the data into an Oracle object(Collection) and process it. Then the processing summary will be loaded into Transaction table and return the Primary key.
Now the problem is, when the temporary tables are loaded with more than 200,000 rows, in some cases the system is running for hours before it finish. And during the process the session shows as EXPIRED in the database and CPU utilization for the respective ProcessId in Unix is almost 100%. Then after a while the session comes alive and finishes the process.
And for some other cases, with same row count, the entire process finished in seconds.
If the same process (PL/SQL package) when run directly using a separate session inside the database(and the temporary tables are still available), rather than calling from Pro*c, it finishes in seconds, where it took hours when called from Pro*c.
It will be highly appreciated, if anyone let me know, what actually is wrong. whether it is the resource allocation or should there any known problem in calling huge PL/SQL packages from Pro*C.
we are using Oracle 10g and HP-UX ed42 B.11.31 U System.
regards
SajidDear Colleague
I just want to rephrase the problem again.
We have a Pro*C application. This will read the binary file and dump the data in ascii format to a data file. Then, within from the pro*C, 14 Dynamic tables will be created using EXEC SQL EXECUTE IMMEDIATE statement, each having almost a maximum of 45 columns. Also, created INDEXES to the tables in the same way from Pro*C.
And Control file will be created as follows
OPTIONS (SILENT=(FEEDBACK)) UNRECOVERABLE
LOAD DATA
INTO TABLE FILENAME_BCI_USED
FIELDS TERMINATED BY '|'
TRAILING NULLCOLSColumns Listed
Then Sql loader will be called using system commands (from pro*C itself) to loead the data into the table, as follows.
sprintf(syscommand,"sqlldr %s CONTROL=%s DATA=%s log=%s rows=5000 direct=true", glb_connect_string,ctl_file,data_file, log_file );
ret_value = system(syscommand);data loaded successfully.
Then the Pro*C will call a PL/SQL package for processing the data.
The PL/SQL package, to process the data, dynamically construct the below query and use it for the reference cursor to retrieve data and load into a collection.
v_sql_query := 'SELECT '|| '/*+ index(b '||p_File_Name ||'_1) index(b '||p_File_Name ||'_2) index(s '||p_File_Name ||'_3) index(s '||p_File_Name ||'_4) index(s '||p_File_Name ||'_5) index(s '||p_File_Name ||'_6) index(e '||p_File_Name ||'_7)*/' || '
iot_call_record(b.rec_no ,
b.rec_type ,
substr(b.field1,1,15) ,
nvl(substr((select s0.field1 from ' || SU_Table ||
' s0 where s0.rec_no = s.rec_no and s0.sub_rec_type = 203) ,1, 25),
substr(b.field2, 1, 25)),
substr(b.field3,1,25) ,
b.field4 ,
b.field5 ,
s.field1 ,
s.field2 ,
(select sum(s1.field1) from ' || SU_Table ||
' s1 where s1.field2 = s.rec_no and trim(s1.field2) = ''00'' ) ,
s.field3 ,
e.field2/power(10,e.field3) ,
s.field4 ,
s.field5 ,
s.field6 ,
s.field7 ,
s.field8 ,
s.field9 ,
s.field10 ,
nvl(b.field6,''F'') ,
NULL ,
s.field11 ,
(select sum(s2.field11) from ' || SU_Table || ' s2 where s2.rec_no = s.rec_no) ,
NULL)
FROM ' || BCI_Table || ' b , ' || SU_Table || ' s, ' || EXCH_Table ||
' e WHERE b.filename = s.filename
AND b.rec_no = s.rec_no
AND (b.field7 = 0 OR b.field7 = 1)
AND TRIM(s.chg_type) = ''00''
AND (s.field1 = e.field2_Code )
AND not(s.field4 = ''V'' and s.field12 > 1)
AND not(s.field4 = ''W'' and s.field12 > 1)
AND not(b.rec_type = 75 and s.field12 > 1)
AND not(b.rec_type = 75 and s.field4 =''D'')
AND s.sub_rec_type <> 203
and (s.field12 = 1 or b.rec_type not in (20,30))';
OPEN cur_call_events FOR v_sql_query;
LOOP
g_tab_call_events.DELETE;
-- Execute immediate v_sql_query bulk collect into g_tab_call_events;
FETCH cur_call_events BULK COLLECT
INTO g_tab_call_events limit 5000;
EXIT WHEN g_tab_call_events.COUNT = 0;
BEGIN
SAVEPOINT Block_Begin;
process_records(p_file_name,
g_tab_call_events);
EXCEPTION
WHEN Severe_Error THEN
Write_error('S');
ROLLBACK TO Block_Begin;
WHEN Warning THEN
Write_error('W');
WHEN NO_DATA_FOUND THEN
Write_error('S');
ROLLBACK TO Block_Begin;
END;
END LOOP;And the above module is behaving strangely.
With almost 150K or more rows in BCI_Table & SU_Table each and less than 10 rows in EXCH_Table, the application takes more than 100 minutes to complete the process.
When we checked the session activity, it is showing the same query for a very long time.
Where as files with 100K or less rows are getting processed in a minute.
And the performance for 150K+ rows is inconsistent, that when we isolate the package and run it directly calling from oracle, it is getting executed in less than 4 minutes. Whereas it takes 100+ minutes from Pro*C.
The execution plan for the above query is given below
Object Owner Object Name Cost Cardinality Bytes CPU cost IO cost
SELECT STATEMENT, GOAL = HINT: FIRST_ROWS 494 2497 494406 143334576 483
TABLE ACCESS BY INDEX ROWID SCHEMA1 FILENAME_SU_USED 4 1 21 30610 4
INDEX RANGE SCAN SCHEMA1 FILENAME_3 3 1 21764 3
SORT AGGREGATE 1 13
INDEX RANGE SCAN SCHEMA1 FILENAME_5 3 1 13 22064 3
SORT AGGREGATE 1 7
TABLE ACCESS BY INDEX ROWID SCHEMA1 FILENAME_SU_USED 4 1 7 30706 4
INDEX RANGE SCAN SCHEMA1 FILENAME_3 3 1 21764 3
CONCATENATION
HASH JOIN 355 2496 1307904 103068617 347
TABLE ACCESS FULL SCHEMA1 FILENAME_EXCH_USED 3 2 26 35987 3
HASH JOIN 352 2496 813696 96532618 344
VIEW SYS VW_NSO_1 4 20 880 12549326 3
HASH UNIQUE 4 20 220 12549326 3
TABLE ACCESS FULL SCHEMA2 IOT_SERVICE_MATRIX 3 20 220 45207 3
HASH JOIN 347 15850 2234850 76145180 341
TABLE ACCESS FULL SCHEMA1 FILENAME_SU_USED 130 16584 1111128 33625872 127
TABLE ACCESS FULL SCHEMA1 FILENAME_BCI_USED 217 23757 1758018 31405896 214
NESTED LOOPS 139 1 198 40265959 136
NESTED LOOPS 135 1 154 27716633 133
NESTED LOOPS 132 1 141 27680646 130
TABLE ACCESS FULL SCHEMA1 FILENAME_SU_USED 129 1 67 27655992 127
TABLE ACCESS BY INDEX ROWID SCHEMA1 FILENAME_BCI_USED 3 1 74 24654 3
INDEX RANGE SCAN SCHEMA1 FILENAME_1 2 1 15493 2
TABLE ACCESS FULL SCHEMA1 FILENAME_EXCH_USED 3 1 13 35987 3
VIEW SYS VW_NSO_1 4 1 44 12549326 3
SORT UNIQUE 4 20 220 12549326 3
TABLE ACCESS FULL SCHEMA2 IOT_SERVICE_MATRIX 3 20 220 45207 3Regards
Sajid
Edited by: user12039545 on Jul 11, 2010 12:05 AM
Edited by: user12039545 on Jul 11, 2010 12:15 AM
Edited by: user12039545 on Jul 11, 2010 12:32 AM
Edited by: user12039545 on Jul 11, 2010 12:34 AM
Edited by: user12039545 on Jul 11, 2010 12:37 AM -
Adding to WHERE based on an IF statement in a procedure
Is this legitimate?
select CRIME_CLASSIFICATION_ID, crime_type, nvl(count(CRIME_CLASSIFICATION_ID),0) as CRIMECNT
From vaps.vw_offenses
where location_id in (vaLoc)
If fromdate is not null Then
AND offense_date >= to_date(fromdate, 'mm/dd/yyyy') AND offense_date <= to_date(todate,'mm/dd/yyyy')
End If;
group by crime_classification_id, crime_type
If it's not legitimate, how do I get the added clause into my query based on the value of fromdate?
Thanks
ChrisHi, Chris,
Perhaps you want soemthing like this:
WHERE location_id in (vaLoc)
AND ( fromdate IS NULL
OR offense_date BETWEEN TO_DATE (fromdate, 'mm/dd/yyyy')
AND TO_DATE (todate, 'mm/dd/yyyy')
By the way, storing date information in string columns or variables is a really bad idea. Use DATE columns and variables for date information; it will be simpler, more robust and more efficient; you won't need to use TO_DATE in queries like this.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Point out where the condition above is giving the wrong results, and explain, using specific examples, how you get the correct results from the given data in those places. If you changed the condition at all, post your code.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Query based on "NATURAL JOIN" statement of Oracle9i
I have created following 4 tables
create table CUST_MASTER
(CUST_NO NUMBER(3),CUST_NAME VARCHAR2(20),CUST_CITY VARCHAR2(20));
create table ITEM_MASTER
(ITEM_NO NUMBER(2),ITEM_NAME VARCHAR2(20),
PRICE NUMBER(4));
create table ORDER_HEADER
( ORDER_NO NUMBER(4), CUST_NO NUMBER(3));
create table ORDER_ITEMS
( ORDER_NO NUMBER(4), ITEM_NO NUMBER(2), QTY NUMBER(3));
Based on the above 4 table I have executed the following query.
select c.cust_no, c.cust_name, c.cust_city, oh.order_no, i.item_no, i.item_name, i.price, oi.qty
from cust_master c, item_master i, order_header oh, order_items oi
where c.cust_no = oh.cust_no and oh.order_no = oi.order_no and oi.item_no = i.item_no;
How should I build similar query in Oracle9i making use of "NATURAL JOIN" statement?Hallo,
yes you are correct.
From SQL Reference
NATURAL JOIN The NATURAL keyword indicates that a natural join is being performed. A natural join is based on all columns in the two tables that have the same name. It selects rows from the two tables that have equal values in the relevant columns
Nothing about foreign keys.
Test:
select * from scott.emp natural join scott.dept
DEPTNO EMPNO ENAME JOB MGR HIREDATE SAL COMM DNAME LOC
20 7369 SMITH CLERK 7902 17.12.1980 800 RESEARCH DALLAS
30 7499 ALLEN SALESMAN 7698 20.02.1981 1600 300 SALES CHICAGO
30 7521 WARD SALESMAN 7698 22.02.1981 1250 500 SALES CHICAGO
20 7566 JONES MANAGER 7839 02.04.1981 2975 RESEARCH DALLAS
30 7654 MARTIN SALESMAN 7698 28.09.1981 1250 1400 SALES CHICAGO
30 7698 BLAKE MANAGER 7839 01.05.1981 2850 SALES CHICAGO
10 7782 CLARK MANAGER 7839 09.06.1981 2450 ACCOUNTING NEW YORK
20 7788 SCOTT ANALYST 7566 19.04.1987 3000 RESEARCH DALLAS
10 7839 KING PRESIDENT 17.11.1981 5000 ACCOUNTING NEW YORK
30 7844 TURNER SALESMAN 7698 08.09.1981 1500 0 SALES CHICAGO
20 7876 ADAMS CLERK 7788 23.05.1987 1100 RESEARCH DALLAS
30 7900 JAMES CLERK 7698 03.12.1981 950 SALES CHICAGO
20 7902 FORD ANALYST 7566 03.12.1981 3000 RESEARCH DALLAS
10 7934 MILLER CLERK 7782 23.01.1982 1300 ACCOUNTING NEW YORK
alter table scott.emp drop constraint fk_deptno
select * from scott.emp natural join scott.dept
DEPTNO EMPNO ENAME JOB MGR HIREDATE SAL COMM DNAME LOC
20 7369 SMITH CLERK 7902 17.12.1980 800 RESEARCH DALLAS
30 7499 ALLEN SALESMAN 7698 20.02.1981 1600 300 SALES CHICAGO
30 7521 WARD SALESMAN 7698 22.02.1981 1250 500 SALES CHICAGO
20 7566 JONES MANAGER 7839 02.04.1981 2975 RESEARCH DALLAS
30 7654 MARTIN SALESMAN 7698 28.09.1981 1250 1400 SALES CHICAGO
30 7698 BLAKE MANAGER 7839 01.05.1981 2850 SALES CHICAGO
10 7782 CLARK MANAGER 7839 09.06.1981 2450 ACCOUNTING NEW YORK
20 7788 SCOTT ANALYST 7566 19.04.1987 3000 RESEARCH DALLAS
10 7839 KING PRESIDENT 17.11.1981 5000 ACCOUNTING NEW YORK
30 7844 TURNER SALESMAN 7698 08.09.1981 1500 0 SALES CHICAGO
20 7876 ADAMS CLERK 7788 23.05.1987 1100 RESEARCH DALLAS
30 7900 JAMES CLERK 7698 03.12.1981 950 SALES CHICAGO
20 7902 FORD ANALYST 7566 03.12.1981 3000 RESEARCH DALLAS
10 7934 MILLER CLERK 7782 23.01.1982 1300 ACCOUNTING NEW YORK
ALTER TABLE scott.emp
ADD CONSTRAINT fk_deptno FOREIGN KEY (deptno)
REFERENCES SCOTT.dept (deptno)
ENABLE NOVALIDATE
/Regards
Dmytro Dekhtyaryuk -
Conditional formating, based on a complex statement
Hello,
I'm trying to enhance an existing report, by adding a conditonal formatting on a table.
I know how to do it when the condition is "simple" : <?if:FIELD='VALUE'?>, but the statement I want to use is based on two different fields (or even more).
Basically, I'd like to do <?if:FIELD1='VALUE' or :FIELD2='VALUE'?>, but it doesn't work this way.
Is it only because my syntax is wrong, or is til impossible to do ? Is there a woarkaround I could use ?
Thganks for your answersIt is possible to do such checks;
Try this: <?if:(FIELD1='VALUE' ) or (FIELD2='VALUE')?>... <?end if?>
Thanks! -
Multiplying 2 values based on an If statement in SSRS reports
I am working on a pretty complicated report, and I am unable to get the values to multiply correctly on one line. The expression is simple, if the value in textbox293 is greater then the value in textbox294 then multiply textbox293 by textbox289 else
multiply textbox294 by textbox289.
In SSRS terms IIF(textbox293.value > textbox294.value, textbox293.value * textbox289.value, textbox294.value * textbox289.value)
I am using the actual formulas that I used to get the values, they have a nested IIF statement to return 0.00 if the value is less < 0. I am also rounding to 6 decimal places on 1 value to ensure I get the correct value out to 4 decimal places.
I have checked all of the value on the report up to this point are correct, and are displaying correctly. I have broken apart my IIF statement to make it easier to read:
=IIF(IIF((Sum(Fields!RSR_MIN_2.Value, "Revenue") + IIF((Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value, "End_Fund_Balance"))
* (Sum(Fields!RGF_MIN_2.Value, "Revenue") / First(Fields!RGF_MIN_2.Value, "Rev_Code5899"))< 0, 0.00, (Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value,
"End_Fund_Balance")) * (round(Sum(Fields!RGF_MIN_2.Value, "Revenue") / First(Fields!RGF_MIN_2.Value, "Rev_Code5899"),6))))/(First(Fields!WADA2011_1.Value, "Second_Year_Preceeding_WADA")) < 0, 0.00, (Sum(Fields!RSR_MIN_2.Value,
"Revenue") + IIF((Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value, "End_Fund_Balance")) * (Sum(Fields!RGF_MIN_2.Value, "Revenue")
/ First(Fields!RGF_MIN_2.Value, "Rev_Code5899"))< 0, 0.00, (Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value, "End_Fund_Balance"))
* (round(Sum(Fields!RGF_MIN_2.Value, "Revenue") / First(Fields!RGF_MIN_2.Value, "Rev_Code5899"),6))))/(First(Fields!WADA2011_1.Value, "Second_Year_Preceeding_WADA")))
>
=IIF((Sum(Fields!RSR_MIN_1.Value, "Revenue") + IIF((Sum(Fields!SR_MINUS_1.Value, "Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(Sum(Fields!RGF_MIN_1.Value,
"Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"))< 0, 0.00, (Sum(Fields!SR_MINUS_1.Value, "Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(round(Sum(Fields!RGF_MIN_1.Value,
"Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"),6)))) / (First(Fields!WADA2012_1.Value, "Second_Year_Preceeding_WADA")) < 0, 0.00, (Sum(Fields!RSR_MIN_1.Value, "Revenue") + IIF((Sum(Fields!SR_MINUS_1.Value,
"Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(Sum(Fields!RGF_MIN_1.Value, "Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"))<
0, 0.00, (Sum(Fields!SR_MINUS_1.Value, "Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(round(Sum(Fields!RGF_MIN_1.Value, "Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"),6))))
/ (First(Fields!WADA2012_1.Value, "Second_Year_Preceeding_WADA")))
IIF((Sum(Fields!RSR_MIN_2.Value, "Revenue") + IIF((Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value, "End_Fund_Balance")) * (Sum(Fields!RGF_MIN_2.Value,
"Revenue") / First(Fields!RGF_MIN_2.Value, "Rev_Code5899"))< 0, 0.00, (Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value, "End_Fund_Balance"))
* (round(Sum(Fields!RGF_MIN_2.Value, "Revenue") / First(Fields!RGF_MIN_2.Value, "Rev_Code5899"),6))))/(First(Fields!WADA2011_1.Value, "Second_Year_Preceeding_WADA")) < 0, 0.00, (Sum(Fields!RSR_MIN_2.Value, "Revenue")
+ IIF((Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value, "End_Fund_Balance")) * (Sum(Fields!RGF_MIN_2.Value, "Revenue") / First(Fields!RGF_MIN_2.Value,
"Rev_Code5899"))< 0, 0.00, (Sum(Fields!SR_Minus_2.Value, "Certificated_Exp") - First(Fields!RSR_MIN_2.Value, "Rev_Code5899") - First(Fields!End_Fund_min2.Value, "End_Fund_Balance")) * (round(Sum(Fields!RGF_MIN_2.Value,
"Revenue") / First(Fields!RGF_MIN_2.Value, "Rev_Code5899"),6))))/(First(Fields!WADA2011_1.Value, "Second_Year_Preceeding_WADA"))) * (first(Fields!WADA2013_1.Value,"Second_Year_Preceeding_WADA"))
IIF((Sum(Fields!RSR_MIN_1.Value, "Revenue") + IIF((Sum(Fields!SR_MINUS_1.Value, "Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(Sum(Fields!RGF_MIN_1.Value,
"Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"))< 0, 0.00, (Sum(Fields!SR_MINUS_1.Value, "Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(round(Sum(Fields!RGF_MIN_1.Value,
"Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"),6)))) / (First(Fields!WADA2012_1.Value, "Second_Year_Preceeding_WADA")) < 0, 0.00, (Sum(Fields!RSR_MIN_1.Value, "Revenue") + IIF((Sum(Fields!SR_MINUS_1.Value,
"Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(Sum(Fields!RGF_MIN_1.Value, "Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"))<
0, 0.00, (Sum(Fields!SR_MINUS_1.Value, "Certificated_Exp")-first(Fields!RSR_MIN_1.Value,"Rev_Code5899")-first(Fields!End_FundMinus1.Value,"End_Fund_Balance"))*(round(Sum(Fields!RGF_MIN_1.Value, "Revenue")/first(Fields!RGF_MIN_1.value,"Rev_Code5899"),6))))
/ (First(Fields!WADA2012_1.Value, "Second_Year_Preceeding_WADA"))) * (first(Fields!WADA2013_1.Value,"Second_Year_Preceeding_WADA")))
A screen shot of the report:
The value in the bottom box should be: 37,080,118.75
I have tried:
=IIF(ReportItems!Textbox293.Value > ReportItems!Textbox294.Value, ReportItems!Textbox293.Value * ReportItems!Textbox289.Value, ReportItems!Textbox294.Value * ReportItems!Textbox289.Value) and I get a scope error.
I have also tried
=IIF(CDbl(Fields!Textbox293.Value) > CDbl(Fields!Textbox294.Value), CDbl(FieldsTextbox293.Value) * CDbl(Fields!Textbox289.Value), CDbl(Fields!Textbox294.Value) * CDbl(Fields!Textbox289.Value))
I get the same scope error, part of the problem here is that in order to get things to display correctly each row in this section of the report is a different table
Row1 = tablix19
Row2 = tablix20
Row3 = tablix21
Any help here would be greatHello,
In your case, we can try to use Report Variables to resolve the issue. In SSRS, when we have a complex calculation we can create a variable in the report. Variable can be used more than once in a report. Please refer to the following steps:
Open Report Properties dialog box.
Click Variables in the left pane. Then, add specific variable.
(Note: Suppose we have create two variables: textbox293, textbox294)
After that, we can use following expression to calculate the effect:
=IIF(Variables! textbox293.Value > Variables! textbox294.Value,
Variables! textbox293.Value * ReportItems!Textbox289.Value,
Variables! textbox294.Value * ReportItems!Textbox289.Value)
Reference:
Report and Group Variables Collections References
If the issue is persist, please feel free to let me know.
Regards,
Alisa Tang
If you have any feedback on our support, please click
here.
Alisa Tang
TechNet Community Support -
How do I use a daq analog input value to output a voltage based on if/then statements?
I am the first one here to start using labview and am not familiar with any of it. I am pressed for time and need simple solutions to accquire two analog signals from turbidimeters in volts and use them to turn an alum pump on or off in order to automate a pilot water treatment plant. If someone could correspond with me via email or instant messaging, I would greatly appreciate the assistance. I recognize the power of labview but have been tinkering with it for a week now and have no luck producing results. I do not know if there is already a VI out there that does this, but that would be a tremendous help. Again, someone to correspond with would be the ideal solution.
Thank
s,
JackBasically the job isn't very difficult. All you have to do is use the built-in comparison fucntions to generate a logic level based on the value of the meter output. This boolean value (a green wire on the diagram) can drive the selector input of a case structure. In the case structure you put the code to turn the pump on or off as needed.
Contact me directly at [email protected] and I can give you more details if you need them or have more questions.
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
Attachments:
demo.vi 13 KB
Maybe you are looking for
-
Hi, I find a very strange issue in our system, in FBL1N, for one vendor, i can see vendor open items, but in F-44, i just can not select these open item out for this vendor, so can not clear vendor open items, does anybody has met this strange issue
-
Do nested tables conflict with ?split-by-page-break:? -getting blank pages
I have an RTF template with multiple levels of groupingwith sub-totals and pagebreaks at several levels. I'm using nested tables to keep the lowest level group together. The nested table works fine as far as keeping the rows together - if a group doe
-
Asset master change through LSMW
Hi, I want change the location for 1250 Assets.i want to use LSMW. Will you please explain first 4 steps of LSMW for this. Thanks Rafi
-
Is it possible following batch processing using javascript...?
Hi Everyone, Is it possible with in javascript following batch processing? • Open all PDF files in folder • Get which font to be used • Get which color plate to be used (i.e.) CMYK or RGB • Get page trim size width and Height. • Close the file • Past
-
Hi, When I changed the message mapping ( GMT ) and activating the change list, XI int.builder throwing error with javac path not found. Any help on this is greatly appreciated. Thanks, Daniel.LA