Conditions - Top 10 - Should return 10 values ?
We have used conditions extensively, however this issue is causing us some grief.
We have a query to calculate Debtor Days. We have two conditions on Debtors, one to show Bottom 10 and one to show Top 10. Bottom 10 works perfectly, however Top 10 returns 7 values when you Activate it.
There are over 80 values in total so it's not a case of it only showing all values.
Any ideas?
Thanks
Gill
Thanks for your reply.
I've cut the query down to only one characteristic and still the same result.
Regards
Gill
Similar Messages
-
Feature request: recursionGuard:performWithGuard() should return a value
It would be better if recursionGuard:performWithGuard () were like LrFunctionContext.callWithContext() and returned the result of the called function. As a general rule, any such "control-flow" wrapper should return the result of the called function.
So far I've been using home-brewed recursion guarding, a.k.a. flag variables, however its hard to imagine returning function results not being a good idea...
Rob -
Single RFC Lookup should return multiple values - but returns no values
I have an RFC Lookup in my PID system that i had to change due to a test defect.
the FM i wrote was working on a single value and returning the correct entry... however it now needs to return multliple entries and map 0..unbounded....
i have made the changes, the FM works in ECD, however when i call the FM from the mapping, it does not return any values... now, i am asking my basis team to change the PIAPPLUSER to dialog user so i can throw a breakpoint for an external user...
has anyone done a single to multi value mapping on lookup? i am not sure that it is the FM that is incorrect as it is very simple code..
DATA: lt_jobtype TYPE zhr_lkupjobtype_t.
CLEAR lt_jobtype.
REFRESH lt_jobtype.
SELECT * FROM zhr_lkupjobtype
INTO TABLE lt_jobtype
WHERE zinterface_id = import-zinterface_id
AND zsap_jobtype = import-zsap_jobtype.
MOVE lt_jobtype TO export.
is there a way of checking the RFC part of an message mapping? i checked the full trace within graphical mapping but this shows no return....I am using a MOVE instead of APPEND.
according to the keyword help if the tables are identical, you can use MOVE.
it works when i test in SE37.
i have tested it both ways and i get the same result each time.
i even tried it this way:
SELECT * FROM zhr_lkupjobtype
INTO TABLE export
WHERE zinterface_id = import-zinterface_id
AND zsap_jobtype = import-zsap_jobtype.
and that works too to get the target values into the export table! that's what made me think it was not the code as i have tried three different ways of writing the same code... the Function Module works perfectly anyway! but when it is called from PI i cannot see if any values are returned.... -
Pl/sql package for use with workflow will not return a value
hi all,
just trying to intercept a requisition being turned into an order if it uses a certain cost code. so i have amended the workflow and created a package to check what cost centre a requisition is using. how over the workflow stops on the function that calls the package witha a status of complete as if the package is not returning any values.
the package is as below:
CREATE OR REPLACE PACKAGE APPS.xxhccWFcapitalcheck AS
procedure XXHCC_CHECK_CAPITAL(itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY vARCHAR2);
END xxhccWFcapitalcheck;
CREATE OR REPLACE PACKAGE BODY APPS.xxhccWFcapitalcheck AS
procedure XXHCC_CHECK_CAPITAL(itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY varchar2 ) is
x_progress varchar2(100);
x_resultout varchar2(30);
l_doc_mgr_return_val VARCHAR2(1);
l_doc_string varchar2(200);
l_preparer_user_name varchar2(100);
doc_manager_exception exception;
p_test varchar2(100);
l_req_id varchar2(30);
CURSOR p_line_id IS
SELECT
codes.segment2 cost_center
FROM
po_requisition_headers_all headers,
po_requisition_lines_all lines,
po_req_distributions_all dist,
gl_code_combinations_v codes
WHERE
headers.requisition_header_id = lines.requisition_header_id
AND
lines.requisition_line_id = dist.requisition_line_id
AND
dist.code_combination_id = codes.code_combination_id
AND
headers.segment1 = l_req_id;
line_rec p_line_id%rowtype;
BEGIN
-- Do nothing in cancel or timeout mode
--if (funcmode <> wf_engine.eng_run) then
-- resultout := wf_engine.eng_null;
-- return;
-- end if;
l_req_id := wf_engine.GetItemAttrNumber (itemtype => itemtype,
itemkey => itemkey,
aname => 'DOCUMENT_NUMBER');
--FOR line_rec in p_line_id
---loop
open p_line_id;
fetch p_line_id into l_doc_string;
close p_line_id;
IF p_line_id= 'Q9DEF'
dbms_output.put_line p_line_id;
Then resultout := 'COMPLETE:F';
return;
p_test := 'USE DIFFERENT CODE';
ELSE
resultout := 'COMPLETE:T';
return;
END IF;
END LOOP;
end;
END xxhccWFcapitalcheck;
any help would be great!Hi Community, first of all, english is not my native language and im not sure to use the correct terms for PowerCenter - so if im wrong please help me correct and make clear what we need. We have a kind of 3-steps ToDo. First step: Load data from an external source into a "local" datastore (its an oracle db on a server in our "hands")Second step: Check data against several verifications, this is done with a PL/SQL Package. The PL/SQL Package shall be called with an Interfacename who is set in the First PowerCenter Mapping. Our current thoghts are to do this via a stored procedure, which runs as "Target Post Load" and gets a variable "Interface Name".Is that possible? Im not quite sure about it. About the last part its even more unclear how we can solve it:Third part should be switch back to PowerCenter now - and the package (or to be correct a function in the package) should return a value for "okay everything fine => workflow continue" or "something happened => workflow is stopped" Im not sure how i can handle this. I hope my explanations are good enough so you can provide some help?!If there are any questions please ask! Thank you alot, best regards, Christian
-
How to get a function to return a value occuring after a character
I need to write a function to return the next value occurring after the ":" character in a column. If multiple values of ":" occurs then the function should return the sum of the next value occurring after each ":" in the column.
For example a rating value of 4:1 would return the value of 1. However, the rating of "5:1:1" should return a value of 1+1 = 2, and 6:2:1 will return of 2+1 = 3.
I have the below function skeletion and trying to figure out how the select statement will compute based on the position of : in the column and add the values and return the value back to function.
Function fn_check_internalrating(p_internalrating IN VARCHAR2)
RETURN number
IS
cnumber number;
cursor c1 is
select ................................
BEGIN
open c1;
fetch c1 into cnumber;
close c1;
RETURN cnumber;
EXCEPTION
WHEN OTHERS
THEN RETURN NULL;
END;Hi,
You don't need a cursor: there's no table involved in this function, and no point in using any table.
Here's one way:
CREATE OR REPLACE FUNCTION fn_check_internalrating
( p_internalrating IN VARCHAR2
, p_delimiter IN VARCHAR2 DEFAULT ':'
RETURN NUMBER
DETERMINISTIC -- Same input always produces same output
IS
cnumber NUMBER := 0; -- value to be returned
pos PLS_INTEGER := INSTR ( p_internalrating
, p_delimiter
); -- position where delimiter was found
BEGIN
WHILE pos != 0
LOOP
cnumber := cnumber + TO_NUMBER ( SUBSTR ( p_internalrating
, pos + 1
, 1
pos := INSTR ( p_internalrating
, p_delimiter
, pos + 1
END LOOP;
RETURN cnumber;
END fn_check_internalrating;
SHOW ERRORSThis assumes the function is a stand-alone function. If it's part of a package, you don't say CREATE OR REPLACE at the beginning.
Try to make functions generic, so that if a similar (but not identical) situation comes up in 6 months from now, you can use the same function. I'm guessing that somethimes you may want to do the same thing with some character other than ':' before each number, so I added the 2nd (optional) argument p_delimiter. You can call the fucntion with either 1 or 2 arguments.
If an error occurs in a PL/SQL fucntion, an error message (showing the exact location of the error) is displayed, and execution halts. If you use an EXCEPTION sectinn, you lose all that functionality, or have to code it yourself. Only use an EXCEPTION handler when you really have to.
For this function, you may or may not want to. For example, if the character right after a delimiter is not a digit, the call to TO_NUMBER in function will raise "ORA-01722: invalid number". You may want to catch that error in an exception handler, and return 0 or NULL. On the other hand, you may want to test that the character after the delimiter is a digit before calling TO_NUMBER, and not have an EXCEPTION section.
What else could go wrong? Try to think of potential problems and fix them when you first write the function. If you discover an error next year, you'll have to spend a fair amount of time finding the function, and getting acquainted with it again.
What should the function return if p_internalrating is NULL, or doesn't contain any delimiters?
What if there's a number longer than 1 digit after a delimiter, e.g. '6:78:9'? -
AudiCLip.play should return a boolean value
Java Experts,
looks like it's a bug in java, the audioClip.play method should return a boolean value indicating whether it was able to play the clip or not. Because sometimes the method doesn't play anything. Right now the method plays asynchronously that may be the reason that it returns a void. Thoughts???
Q.i agree with you..i also encountered this problem sometimes the play method doesn't play and the programmer has no clue to figure this out programmetically...Looks like this problem has no solution..where are java experts in this forum??
-
Query with subquery should return value but doesn't
When I run this SQL, it returns no value:
SELECT vfn.cat
FROM vps_fishery_ner vfn, valid_fishery vf
WHERE vfn.plan = vf.plan
AND vfn.cat = vf.cat
AND vf.permit_year = 2010
AND vf.moratorium_fishery = 'T'
AND vfn.vp_num = 211652
AND vfn.ap_year = 2010
AND vfn.plan = 'MUL'
AND vfn.date_issued = (SELECT MAX(date_issued)
FROM vps_fishery_ner
WHERE vp_num = 211652
AND ap_year = 2010);
In order to test, I take out the subquery and run it separately:
SELECT MAX(date_issued)
FROM vps_fishery_ner
WHERE vp_num = 211652
AND ap_year = 2010;
Returns 02-APR-10
Then I paste this date into the original query (using the TRUNC function, of course, since I hardcode only the DDMMYY part of the date):
SELECT vfn.cat
FROM vps_fishery_ner vfn, valid_fishery vf
WHERE vfn.plan = vf.plan
AND vfn.cat = vf.cat
AND vf.permit_year = 2010
AND vf.moratorium_fishery = 'T'
AND vfn.vp_num = 211652
AND vfn.ap_year = 2010
AND vfn.plan = 'MUL'
AND TRUNC(date_issued) = TO_DATE('02-APR-10');
And this returns the required value, 'A'.
So why doesn't the full query with subquery work, if the value that is returned by the subquery is valid and works when you just paste it in?
Thanks.Hi,
Not sure about your question.
But you say when you uss 01-apr-10 you get the expected results.
So why dont you try using trunc on botht sides
SELECT vfn.cat
FROM vps_fishery_ner vfn, valid_fishery vf
WHERE vfn.plan = vf.plan
AND vfn.cat = vf.cat
AND vf.permit_year = 2010
AND vf.moratorium_fishery = 'T'
AND vfn.vp_num = 211652
AND vfn.ap_year = 2010
AND vfn.plan = 'MUL'
AND trunc(vfn.date_issued) = (SELECT MAX(trunc(date_issued))
FROM vps_fishery_ner
WHERE vp_num = 211652
AND ap_year = 2010);Rememeber if you are couting on some Index to be used you might want to recheck.
IN answer to your question why it does not return with subquery included, because the TIME PART is not the same.
You yourself proved it by using the supplying only the date part.
Regards,
Bhushan -
Return multiple values from a function to a SELECT statement
I hope I've provided enough information here. If not, just let me know what I'm missing.
I am creating a view that will combine information from a few tables. Most of it is fairly straightforward, but there are a couple of columns in the view that I need to get by running a function within a package. Even this is fairly straightforward (I have a function named action_date in a package called rp, for instance, which I can use to return the date I need via SELECT rp.action_date(sequence_number).
Here's the issue: I actually need to return several bits of information from the same record (not just action_date, but also action_office, action_value, etc.) - a join of the tables won't work here as I'll explain below. I can, of course, run a separate function for each statement but that is obviously inefficient. Within the confines of the view select statement however, I'm not sure how to return each of the values I need.
For instance, right now, I have:
Table1:
sequence_number NUMBER(10),
name VARCHAR(30),
Table2:
Table1_seq NUMBER(10),
action_seq NUMBER(10),
action_date DATE,
action_office VARCHAR(3),
action_value VARCHAR(60),
I can't simply join Table1 and Table2 because I have to do some processing in order to determine which of the matching returned rows I actually need to select. So the package opens a cursor and processes each row until it finds the one that I need.
The following works but is inefficient since all of the calls to the package will return columns from the same record. I just don't know how to return all the values I need into the SELECT statement.
CREATE VIEW all_this_stuff AS
SELECT sequence_number, name,
rp.action_date(sequence_number) action_date,
rp.action_office(sequence_number) action_office,
rp.action_value(sequence_number) action_value
FROM table1
Is there a way to return multiple values into my SELECT statement or am I going about this all wrong?
Any suggestions?
Thanks so much!Hi,
What you want is a Top-N Query , which you can do using the analytic ROW_NUMBER function in a sub-query, like this:
WITH got_rnum AS
SELECT action_seq, action_dt, action_office, action_type, action_value
, ROW_NUMBER () OVER ( ORDER BY action_date
, action_seq
, action_serial
) AS rnum
FROM table2
WHERE action_code = 'AB'
AND action_office LIKE 'E' -- Is this right?
SELECT action_seq, action_dt, action_office, action_type, action_value
FROM got_rnum
WHERE rnum = 1
;As written, this will return (at most) one row.
I suspect you'll really want to get one row for each group , where a group is defined by some value in a table to which you're joining.
In that case, add a PARTITION BY clause to the ROW_NUMBER function.
If you'd post a little sample data (CREATE TABLE and INSERT statements), I could show you exactly how.
Since I don't have your tables, I'll show you using tables in the scott schema.
Here's a view that has data from the scott.dept table and also from scott.emp, but only for the most senior employee in each department (that is, the employee with the earliest hiredate). If there happens to be a tie for the earliest hiredate, then the contender with the lowest empno is chosen.
CREATE OR REPLACE VIEW senior_emp
AS
WITH got_rnum AS
SELECT d.deptno
, d.dname
, e.empno
, e.ename
, e.hiredate
, ROW_NUMBER () OVER ( PARTITION BY d.deptno
ORDER BY e.hiredate
, e.empno
) AS rnum
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
SELECT deptno
, dname
, empno
, ename
, hiredate
FROM got_rnum
WHERE rnum = 1
SELECT *
FROM senior_emp
;Output:
. DEPTNO DNAME EMPNO ENAME HIREDATE
10 ACCOUNTING 7782 CLARK 09-JUN-81
20 RESEARCH 7369 SMITH 17-DEC-80
30 SALES 7499 ALLEN 20-FEB-81
By the way, one of the conditions in the query you posted was
action_office LIKE 'E'which is equivalent to
action_office = 'E'(LIKE is always equivalent to = if the string after LIKE doesn't contain any wildcards.)
Did you mean to say that, or did you mean something like this:
action_office LIKE 'E%'instead? -
Hi everyone.
Can anyone tell me what is wrong in this code below?
Code:
function NO_DAYSFormula return Number is
begin
IF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT>:P_FR_DT
THEN RETURN (:P_TO_DT-:ACCT_OPN_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:P_TO_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT>:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:MATURITY_DATE+1);
END IF;
END;
It gets compiled successfully but when i run the report, i get 2 errors.
Error 1:
REP-1401: 'no_daysformula':Fatal PL/SQL error occurred.
ora-06503: PL/SQL : Function returned without value.
Error 2:
REP-0619: You cannot run without a layout.
Should i use only 1 return statement?
Can i use as many return statements as i want?
What is the exact mistake? Please let me know.
Thank You.Let me clear you the first thing...
If you get any fatal errors while running the report (e.g., function returned without value,no value etc.,) the report will show
REP-0619: You cannot run without a layout.
So you just correct the function 'no_daysformula' .
First of all you run the report without that formula column.
If it works fine then , Check the return value of your formula column (Your formula column properties --> Return value --> value (It will be DATE as i think so).
As function will always return a single value, Check your formula 'no_daysformula' returns the same.
declare a return variable say for example..
DECLARE
V_DATE DATE;
BEGIN
--YOUR CODE---
RETURN V_DATE := (RETURN VALUE)
END;
Last but not least ... use Else condition to return (NULL or any value ) in your code and check..
If any Problem persists let me know
Regards,
Soofi. -
Return order value is not coming properly
Hi All,
In Export Pricing Procedure we manually enter value for Freight and Insurance.For both condition types in V/06 we have maintained Fixed Amount in Calculation Type.So in the sales order condition screen Pricing is like
Ordered Qty 10 pc
Price USD 100 (Entered manually)
Freight USD 10 ( entered manually)
Insurance USD 20 (entered manually)
Total order Value is USD 120.Here price per item is 12 USD
Now when we create a return order for 5 pc wrt above invoice, Freight and Insurance is not calculated properly.
The system is calculating like
Price USD 50
Freight USD 10
Insurance USD 10
Total Credit Memo/returm order amount is 70 USD.And return price/item is 14 USD.
Here the system calculate Freight and Insurance value by dividing the original value(10 USD 0r 20 USD / return qty.(5pc).
But in the above process the return order value should come 60 USD.So what settings do we need to get the value 60 USD.
Regards
DebasishDear Raj,
Thanks for the reply.I am giving you a brief idea abt the PP and condition types.(For Freight and Insurance ).
For Freight condition type
condition class A
calculation type B
Condition Category F
No Access sequence is assigned
For Insurance Condition Type
Condition class A
Calculation Type B
Condition Category C
No Access sequence is assigned
In PP for both my condition types manual, mandatory and statistics has not been checked.No From To step is maintained.
Coming to your query can you pls elaborate how did u calculate Freight 2 + insurance 4 and the final value should be 56 usd.
Now in my first invoice the invoiced qty was 10 . Freight value was 10 and Insurance value was 10(for the total invoiced qty).
Now when i create return order for 5 qty the system should calculate proportionately.I mean Insurance value should be 5 usd and freight value should be 5 usd.So price is (for 5 qty) 50 usd + Insurance 5 usd + freight 5 usd= 60 usd
If i am wrong then pls correct me.
Regards
Debasish -
'Query not returning string values as expected
Hi
Why would this be happening?
I have an insert statement that looks like this;
UNION ALL
SELECT '59','','last','first','','','','WILLIAMTA','BEB92C5B52566E6594707C69729624BE','','','Senior Officer','Town Name','2','','SUSTAINABLE FOREST MANAGEMENT DIVISION','NAME BRANCH','CURRENT' FROM DUAL
...I then want to create an conditional display statement in an apex application that looks like this;
PLEASE NOT I HAVE REPLACED (the symbols that will not render for not equal to) WITH THE TEXT "NOT EQUAL TO"
SELECT USERNAME
FROM sfm_common.sct_parties
WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
AND username = :app_userBut it doesnt return anything and I know it should so I do some tests, below;
1. You will see the first statement returns no records.
2. In the second statement there is a space between N and the quote, and it returns a record
3. In the third test if I make the gap really big it still returns a value.
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 8 14:27:55 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> SELECT DISTINCT null
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
4 /
no rows selected
SQL> SELECT DISTINCT null
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION '
4 /
N
SQL> SELECT DISTINCT NULL
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION '
4 /
N
SQL>Would anyone know why this has happened, I have checked my insert scripts and there is no space at the end of the text in the column named 'division'.
Ben
Edited by: Benton on Sep 8, 2009 2:59 PMThe table contains attributes like this;
Col_1
TOMATO
ORANGE
APPLE
NULLSo what I was attempting to do was something like this;
SELECT col_1 FROM table WHERE col_1 != 'TOMATO'
I would then expect to see;
Col_1
ORANGE
APPLE
NULLBut instead I had the following returned;
no rows selected
Which is not correct.
Apparently the fact that the column is 255 characters long is causing a problem, but I really dont understand why because I have other tables where I execute columns that are not the exact length of the content and yet the sort of query that I have used as an example work perfectly fine. For example;
SQL> SELECT name
2 FROM table_name
3 WHERE name != 'HYGIENE MANAGEMENT'
4 /
NAME
ACTION
APPROVALS
AUDITING
BURNING
COLLECTION
COMMUNICATION
COMPLIANCE
DEVELOPMENT
DISTURBANCE
DOCUMENT CONTROL
ERADICATION
11 rows selected.
SQL>And the ddl for the table looks like this;
CREATE TABLE "TABLE_NAME"
( "ACT_ID" NUMBER,
"NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"CREATED_BY" VARCHAR2(50 BYTE) DEFAULT 'USER',
"CREATED_ON" DATE DEFAULT SYSDATE,
"EFF_FROM" DATE DEFAULT SYSDATE,
"EFF_TO" DATE,
"DEFINITION" VARCHAR2(4000 BYTE),
"STATUS" VARCHAR2(15 BYTE) DEFAULT 'CURRENT' NOT NULL ENABLE,
CONSTRAINT "TABLE_NAME_CHK1" CHECK ( status IN ('CURRENT','NOT CURRENT')) ENABLE,
CONSTRAINT "TABLE_NAME_PK" PRIMARY KEY ("ACT_ID");The name field in this instance is 50 characters long and the words 'HYGIENE MANAGEMENT' make up 18 characters.
Ben -
XSLT position() not returning sequential values
I'm having trouble with the XSLT position() function. I have the following snippet of XML:
<categories>
<category id="6">
<title>Alumni</title>
</category>
<category id="10">
<title>Built Environment</title>
</category>
<category id="9">
<title>Business</title>
</category>
<category id="81">
<title>Caboolture</title>
</category>
<category id="41">
<title>Corporate</title>
</category>
<category id="2">
<title>Creative Industries</title>
</category>
<category id="61">
<title>Cultural Precinct</title>
</category>
<category id="5">
<title>Education</title>
</category>
<category id="7">
<title>Engineering</title>
</category>
<category id="44">
<title>Feature</title>
</category>
<category id="4">
<title>Health</title>
</category>
<category id="43">
<title>Humanities & Human Services</title>
</category>
<category id="42">
<title>Information Technology</title>
</category>
<category id="8">
<title>Law</title>
</category>
<category id="45">
<title>Profile</title>
</category>
<category id="101">
<title>Public</title>
</category>
<category id="21">
<title>QUT Carseldine</title>
</category>
<category id="1">
<title>Science</title>
</category>
<category id="3">
<title>What's On</title>
</category>
</categories>and the following template to match each category element:
<xsl:template match="category">
<tr>
<td width="10" valign="top" background="graphics/mid_bracket.gif"> </td>
<td width="10" valign="top"><img alt="" width="10" height="15" border="0" src="/graphics/blank.gif" name="rollitem0_{position()}"/></td>
<td width="160"><a href="/general/news-event-list.jsp?news-category-id={@id}" class="level3menu" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('rollitem0_{position()}','','graphics/arrow.gif',1)"><xsl:apply-templates/></a></td>
</tr>
</xsl:template>I would expect the position() function to return 1, 2, 3, 4...19 but it doesn't. It is returning 2, 4, 6, 8...36. Does anyone have any idea why this might be happening? Surely the position should return the position of the current element within its siblings. I can only think that it is counting blank text nodes between each category element. Sorry for the complex markup, I wanted to be sure I was giving a real-world example.
Thanks.Stylesheet:
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output method = "text" />
<xsl:template match = "category" >
<xsl:text >
category[</xsl:text>
<xsl:value-of select = "position()" />
<xsl:text >]: </xsl:text>
<xsl:value-of select = "." />
</xsl:template>
</xsl:stylesheet>
produces output:
category[2]: Alumni
category[4]: Built Environment
category[6]: Business
category[8]: Caboolture
category[10]: Corporate
category[12]: Creative Industries
category[14]: Cultural Precinct
category[16]: Education
category[18]: Engineering
category[20]: Feature
category[22]: Health
category[24]: Humanities & Human Services
category[26]: Information Technology
category[28]: Law
category[30]: Profile
category[32]: Public
category[34]: QUT Carseldine
category[36]: Science
category[38]: What's On
stylesheet:
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output method = "text" />
<xsl:template match = "/" >
<xsl:apply-templates select = "//category" />
</xsl:template>
<xsl:template match = "category" >
<xsl:text >
category[</xsl:text>
<xsl:value-of select = "position()" />
<xsl:text >]: </xsl:text>
<xsl:value-of select = "." />
</xsl:template>
</xsl:stylesheet>
produces output:
category[1]: Alumni
category[2]: Built Environment
category[3]: Business
category[4]: Caboolture
category[5]: Corporate
category[6]: Creative Industries
category[7]: Cultural Precinct
category[8]: Education
category[9]: Engineering
category[10]: Feature
category[11]: Health
category[12]: Humanities & Human Services
category[13]: Information Technology
category[14]: Law
category[15]: Profile
category[16]: Public
category[17]: QUT Carseldine
category[18]: Science
category[19]: What's On -
Registry calls return wrong values - how to fix?
Here is the code used to open the key (all the variations shown produce the same behaviour)
bool Win32_OpenKey( const HKEY uPlaceInRegistry, HKEY& xKey, const char* const szKeyName, const bool bReadOnly = false )
// SE: make sure key exists
// SE - NOTE: this is deprecated. it worked fine, but suddenly doesnt :(
// so i have replaced it with the following line
//const bool bOpened = RegOpenKey( uPlaceInRegistry, szKeyName, &xKey ) == ERROR_SUCCESS;
const bool bOpened = RegOpenKeyEx( uPlaceInRegistry, szKeyName, 0,
bReadOnly ? KEY_QUERY_VALUE : KEY_ALL_ACCESS, &xKey ) == ERROR_SUCCESS;
bool bCreated = false;
if( !bOpened )
// SE - NOTE: this is deprecated. it worked fine, but suddenly doesnt :(
// the Licensor will create keys except in the case where we upgrade a user from
// an old license... so now using the Ex version in hopes it magically works.
//bCreated = RegCreateKey( uPlaceInRegistry, szKeyName, &xKey ) == ERROR_SUCCESS;
DWORD uDisposition = -1;
bCreated = ( RegCreateKeyEx( uPlaceInRegistry, szKeyName, 0, 0,
REG_OPTION_NON_VOLATILE, bReadOnly ? KEY_QUERY_VALUE : KEY_ALL_ACCESS,
0, &xKey, &uDisposition )
== ERROR_SUCCESS );
return bOpened || bCreated;
Here is where the values are queried.
unsigned int uMagic = 0;
unsigned long uType = 0xFFFFFFFF;
unsigned long uSize = sizeof( unsigned int );
//long err = RegGetValue( xKey, 0, "Magic", RRF_RT_DWORD, &uType, &uActivated, &uSize );
uType = REG_DWORD;
long err = RegQueryValueEx( xKey, "Magic", 0, &uType, reinterpret_cast< LPBYTE >( &uMagic ), &uSize );
if( (err == ERROR_SUCCESS) && ( uType == REG_DWORD ) && ( uSize == sizeof( unsigned int ) ) )
unsigned long long ullReadStartDate = 0;
uSize = sizeof( unsigned long long );
err = RegGetValue( xKey, 0, "Number", RRF_RT_QWORD, &uType, &ullReadStartDate, &uSize );
if( (err == ERROR_SUCCESS) && ( uType == REG_QWORD ) && ( uSize == sizeof( unsigned long long ) ) )
The values that are returned do not match the registry.
In fact the values returned are values that we never would have written either. The zero is fishy because maybe it indicates bad behaviour. The messed up time_t value is even more confusing... it comes from a more than 30 days ago, which is around the time
when I first started working on this code.
To make a guess I am getting back an ancient version of the key values which is somehow preserved and accessible but can not be seen in regedit. I have no idea why this is suddenly happening either - this code (before my commented changes were made) worked
exactly as expected for a few weeks now.
Slightly unrelated but it also seems that a standard user can not write to HKCU in our repeatable tests. This seems slightly crazy as well... should I just not be using the registry? It never seemed like a good idea, but I have done it to try and fit the
platform way of doing things after hitting lots of problems with naive use of files...thanks for the tips. will probably come in handy in the future. :)
it turned out to be permissions and bad documentation in my case. the virtual store thing was not writing to where the docs say it should, and so something was lingering somewhere i couldn't find in the right place under any of the top level registry keys.
maybe there is some other place where it has gone in the registry that i am just not finding the documentation for...
my ultimate fix was to use a file in ProgramData :)
I figured I'd try and do it 'the MS way' and use the registry. what a terrible idea that turned out to be, since I guess its no longer the MS way given how riddled with backwards compatibility hacks it seems to be... -
[UIX] How To: Return multiple values from a LOV
Hi gang
I've been receiving a number of queries via email on how to return multiple items from a LOV using UIX thanks to earlier posts of mine on OTN. I'm unfortunately aware my previous posts on this are not that clear thanks to the nature of the forums Q&A type approach. So I thought I'd write one clear post, and then direct any queries to it from now on to save me time.
Following is my solution to this problem. Please note it's just one method of many in skinning a cat. It's my understanding via chatting to Oracle employees that LOVs are to be changed in a future release of JDeveloper to be more like Oracle Forms LOVs, so my skinning skills may be rather bloody & crude very soon (already?).
I'll base my example on the hr schema supplied with the standard RDBMS install.
Say we have an UIX input-form screen to modify an employees record. The employees record has a department_id field and a fk to the departments table. Our requirement is to build a LOV for the department_id field such that we can link the employees record to any department_id in the database. In turn we want the department_name shown on the employees input form, so this must be returned via the LOV too.
To meet this requirement follow these steps:
1) In your ADF BC model project, create 2 EOs for employees and departments.
2) Also in your model, create 2 VOs for the same EOs.
3) Open your employees VO and create a new attribute DepartmentName. Check selected in query. In expressions type (SELECT dept.department_name FROM departments dept WHERE dept.department_id = employees.department_id). Check Updateable always.
4) Create a new empty UIX page in your ViewController project called editEmployees.uix.
5) From the data control palette, drag and drop EmployeesView1 as an input-form. Notice that the new field DepartmentName is also included in the input-form.
6) As the DepartmentName will be populated either from querying existing employees records, or via the LOV, disable the field as the user should not have the ability to edit it.
7) Select the DepartmentId field and delete it. In the UI Model window delete the DepartmentId binding.
8) From the data controls palette, drag and drop the DepartmentId field as a messageLovInput onto your page. Note in your application navigator a new UIX page lovWindow0.uix (or similar) has been created for you.
9) While the lovWindow0.uix is still in italics (before you save it), rename the file to departmentsLov.uix.
10) Back in your editEmployees.uix page, your messageLovInput source will look like the following:
<messageLovInput
model="${bindings.DepartmentId}"
id="${bindings.DepartmentId.path}"
destination="lovWindow0.uix"/>Change it to be:
<messageLovInput
model="${bindings.DepartmentId}"
id="DepartmentId"
destination="departmentsLov.uix"
partialRenderMode="multiple"
partialTargets="_uixState DepartmentName"/>11) Also change your DepartmentName source to look like the following:
<messageTextInput
id=DepartmentName
model="${bindings.DepartmentName}"
columns="10"
disabled="true"/>12) Open your departmentsLov.uix page.
13) In the data control palette, drag and drop the DepartmentId field of the DepartmentView1 as a LovTable into the Results area on your page.
14) Notice in the UI Model window that the 3 binding controls have been created for you, an iterator, a range and a binding for DepartmentId.
15) Right click on the DepartmentsLovUIModel node in the UI Model window, then create binding, display, and finally attribute. The attribute binding editor will pop up. In the select-an-iterator drop down select the DepartmentsView1Iterator. Now select DepartmentName in the attribute list and then the ok button.
16) Note in the UI Model you now have a new binding called DCDefaultControl. Select this, and in the property palette change the Id to DepartmentName.
17) View the LOV pages source, and change the lovUpdate event as follows:
<event name="lovSelect">
<compound>
<set value="${bindings.DepartmentId.inputValue}" target="${sessionScope}" property="MyAppDepartmentId" />
<set value="${bindings.DepartmentName.inputValue}" target="${sessionScope}" property="MyAppDepartmentName" />
</compound>
</event>18) Return to editEmployees.uix source, and modify the lovUpdate event to look as follows:
<event name="lovUpdate">
<compound>
<set value="${sessionScope.MyAppDepartmentId}" target="${bindings.DepartmentId}" property="inputValue"/>
<set value="${sessionScope.MyAppDepartmentName}" target="${bindings.DepartmentName}" property="inputValue"/>
</compound>
</event>Thats it. Now when you select a value in your LOV, it will return 2 (multiple!) values.
A couple things to note:
1) In the messageLovInput id field we dont use the .path notation. This is mechanism for returning 1 value from the LOV and is useless for us.
2) Again in the messageLovInput we supply _uixState as an entry in the partialTargets.
3) We are relying on partial-page-refresh functionality to update multiple items on the screen.
Im not going to take the time out to explain these 3 points, but its worthwhile you learning more about them, especially the last 2, as a separate exercise.
One other useful thing to do is, in your messageLovInput, include as a last entry in the partialTargets list MessageBox. In turn locate the messageBox control on your page (if any), and supply an id=MessageBox. This will allow the LOV to place any errors raised in the MessageBox and show them to the user.
I hope this works for you :)
Cheers,
CM.Thanks Chris,
It took me some time to find the information I needed, how to use return multiple values from a LOV popup window, then I found your post and all problems were solved. Its working perfectly, well, almost perfectly.
Im always fighting with ADF-UIX, it never does the thing that I expect it to do, I guess its because I have a hard time letting go of the total control you have as a developer and let the framework take care of a few things.
Anyway, I'm using your example to fill 5 fields at once, one of the fields being a messageChoice (a list with countries) with a LOV to a lookup table (id , country).
I return the countryId from the popup LOV window, that works great, but it doesn't set the correct value in my messageChoice . I think its because its using the CountryId for the listbox index.
So how can I select the correct value inside my messageChoice? Come to think of it, I dont realy think its LOV related...
Can someone help me out out here?
Kind regards
Ido -
Hi,
How do I return two values from a
stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
Something like ?
CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
@intPeriod INT,
@strPeriod_Length NVARCHAR(1),
@dtStart NVARCHAR(8) OUTPUT,
@dtEnd NVARCHAR(8) OUTPUT
AS
then within the SSIS component; -
Kind Regards,
Kieran.
Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
Add a script task to check ssis variables values using,
Msgbox(Dts.Variables("User::strExtractStartDate").Value)
Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
Regards, RSingh
Maybe you are looking for
-
I've been using Firefox for several years and just ran across a problem within the past two weeks. I usually have several tabs open at the same time while browsing the Internet. Suddenly, when I tried to open a new tab by clicking on the "+" tab at t
-
Hallo ihave created two jsp files wth NWDS. They are at the folder dist / PORTAL-INF / jsp test1.jsp and test2.jsp. test1.jsp: <html> <body> <form action="test2.jsp" method="post"> <input type="text" name="PARAMETER" >
-
Hi All, I have a requirement to implement a standard logic in my custom program for network in work order. Network - Goto IW32 ...eneter order no. then in menu bar->Goto->Grphics->Network structure. Is there FM or BAPI which i can use for this functi
-
Keyboard shortcut for Control+F2, F, Enter
Hello, I am trying to create a keyboard shortcut that would be available to all Applications deliveres the same result as these keystrokes: 1. Control + F2 (move focus to menu bar) 2. F (moves focus to the File menu bar menu) 3. Enter or down arrow (
-
Changing only column header color
Hello, I changed the background color of the tabel to white. But column headers are also appearing as white. How can I change the color of column headers only. I tried several combinations...no luck. Thanks, Sunita.