Reporting with images/ access-permission issue
Hi All,
We created a Crystal Report that contains images for each row. And the report goes to shared folder location to find the related images for each row.
We are trying to set the permissions on this file location and for that we created a user group contains people who is supposed to run this report. However we noticed that when we run the report, report is trying to access to this file location with some other ID (probably a background user) not with the users ID.
Even though my ID is in the security group when I run the report I don't see the images. But I am able to see the images if I preview it directly in the file location.
Now we need to add this background user to the security group to resolve the issue. Does anyone know what this user ID could be?
I appreciate any help.
Regards
Hello,
Now that we know it's a problem with BOE I moved your post to the BOE Admin forum.
The Server are running under the local System Account unless you change it. Go into the CMC and have a look at the Job Server for scheduling or the RAS server for running on Demand reports. You need to give the Local System Account access to where the images are saved as well as the WEB server, which ever one you are using.
Check the WEB server and give it access to the Image Folder as well.
Thanks again
Don
Similar Messages
-
Report with images that are on a directory
I want to create a report with images that are on a directory
of the application server ...
It is possible ??The version is Application Server 9.0.4 and 10G
but i think that it is no important
The report run on the same server where there is the Directory. -
Receiving Error when running Crystal reports with Images in WebSphere 6.1
I am designing a report with a sub report that displays images via (BLOBS). The images are between 10-20 kb in size and there could be up to 200 images in the report.
There are no problems when I run the report using Java 1.5 with Tomcat 5.5 server and JDBC connection (using ojdbc14.jar) to an Oracle 10g database.
It seems that if I attempt to run the same report on a WebSphere 6.1 environment, the below error is encountered (stack trace is below)
I am using Crystal 2008 (ver 12.0.0.683).
Based on the stack trace, I think it is either an IBM JDK javax.* package compatibility issue or the current version of Crystal reports (no service packs installed - current client environment) has a known issue with Websphere.
I searched the forums for any similiar issues but could not find one.
Could installing Service pack 3 solve this issue or is there another possibility?
Any assistance would be greatly appreciated.
Thank you.
Tony.
Stack Trace follows (Needed to trim due to size, trying to keep unique messges) *******
ERROR [pool-14-thread-1] c.u.p.e.g.c.GenerateCrystalReport [GenerateCrystalReport.java : 211] Generate Report: Template =
pusehk08\evm$\EVM REPORTS 5.7.2010\Staging\TEARDOWN_COM.rpt, ReportSDKException caught: javax/imageio/metadata/IIOMetadata.getAsTree(Ljava/lang/String;)Lorg/w3c/dom/Node;
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: javax/imageio/metadata/IIOMetadata.getAsTree(Ljava/lang/String;)Lorg/w3c/dom/Node;
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:237) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:147) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:128) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:111) [CrystalReportsRuntime.jar:12.2.207.916]
at com.utc.pw.evm2.generatereports.crystalreports.GenerateCrystalReport.generateReport(GenerateCrystalReport.java:152) [classes/:na]
at com.utc.pw.evm2.generatereports.ReportThread.run(ReportThread.java:144) [classes/:na]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:678) [na:1.5.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:703) [na:1.5.0]
at java.lang.Thread.run(Thread.java:811) [na:1.5.0]
Caused by: java.lang.VerifyError: javax/imageio/metadata/IIOMetadata.getAsTree(Ljava/lang/String;)Lorg/w3c/dom/Node;
at com.crystaldecisions.reports.common.image.ImageUtils.a(SourceFile:901) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.common.image.ImageUtils.if(SourceFile:873) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.common.JavaImage.do(SourceFile:183) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.common.CrystalImage.createImage(SourceFile:50) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.formatter.formatter.objectformatter.FormattedBlobFieldObject.if(SourceFile:103) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.formatter.formatter.objectformatter.FormattedBlobFieldObject.<init>(SourceFile:57) [CrystalReportsRuntime.jar:12.2.207.916]
[CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.formatter.formatter.paginator.PageFormatter.formatPage(SourceFile:236) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:96) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:247) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.if(SourceFile:642) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.a(SourceFile:586) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.a(SourceFile:636) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.int(SourceFile:672) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1944) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:661) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:167) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:529) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:527) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:525) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:424) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:352) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54) [CrystalReportsRuntime.jar:12.2.207.916]
at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:337) [CrystalReportsRuntime.jar:12.2.207.916]
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:223) [CrystalReportsRuntime.jar:12.2.207.916]
... 8 common frames omitted
2010-07-20 15:57:11,147 ERROR [pool-14-thread-1] c.u.p.e.g.ReportThread [ReportThread.java : 233] Attempt to generate report TEARDOWN using
pusehk08\evm$\EVM REPORTS 5.7.2010\Staging\TEARDOWN_COM.rpt for E733570-01 failed: Generate Report: Template =
pusehk08\evm$\EVM REPORTS 5.7.2010\Staging\TEARDOWN_COM.rpt, ReportSDKException caught: javax/imageio/metadata/IIOMetadata.getAsTree(Ljava/lang/String;)Lorg/w3c/dom/Node;, REPORTSDKEXCEPTION
2010-07-20 15:57:11,147 ERROR [pool-14-thread-1] c.u.p.e.g.ReportThread [ReportThread.java : 238] Exception was caught trying to build report:
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: javax/imageio/metadata/IIOMetadata.getAsTree(Ljava/lang/String;)Lorg/w3c/dom/Node;
Edited by: Liro9999 on Jul 21, 2010 1:55 PMThank you for your reply.
The answer to your question concerning if Websphere is a clean install is no. The client has other applications running on that server. We do not have access to that server other than the log files and I requested information as to what other applications are on the server.
We did try adding a known working version of the IIOMetadata class in the ear file and deploying it in the hopes that class will be loaded before using any other version. Unfortunately, we receive the posted errors. Which may mean that a different version of the class has already been loaded in memory and that is the one being accessed. A request would have to be made to the client for a shutdown and restart of Websphere in determining if that may be the case. Since there are other applications running, coordination and communication to the other application owner will need to be done first.
Any additional ideas will be appreciated.
Thank you.
Tony. -
APEX 5.0. Report with image stored in a BLOB gives ORA-06502.
Hi,
I want to create an Interactive Report - Desktop with an image in which is stored in a BLOB but it returnes a: ORA-06502: PL/SQL: numeric or value error: character to number conversion error.
I have created a test report with only the image (billed - which is a BLOB) and an ID (the PK - a number from a sequence)
select ID, billed from foto
I have tried with and without a formatmask for the ID '999999999999999' and the Type as Plain text as there seems not to be a better choice..
For the 'billed' Type is 'Display Image' and the 'Table Name' and 'BLOB Column' are set. 'Primary Key Column 1' is set to ID. 'Mime Type Colomn' points to a field that contains 'image/jpeg' as the stored image is a photo in jpg.
The image displays OK from a Forms application.
DB is a 11.2.0.4 on Linux 6.6 and APEX is 5.0
What have I missed?
Thanks,
DinoDino Hustinx wrote:
I want to create an Interactive Report - Desktop with an image in which is stored in a BLOB but it returnes a: ORA-06502: PL/SQL: numeric or value error: character to number conversion error.
I have created a test report with only the image (billed - which is a BLOB) and an ID (the PK - a number from a sequence)
select ID, billed from foto
As described in the documentation, the report query must select the length of the BLOB column, not the column itself:
select id, dbms_lob.get_length(billed) billed from foto -
HTML Report with images in LabVIEW 6.1
I am generating an HTML report in LabVIEW 6.1 with an image. When I
save the html file to disk, two files are saved, the report and the
image. The report has the name I specified but the image does not.
It is not readily apparent that the two are related. As a result,
when I try and e-mail or move the report, the image gets left behind.
Is there a way to embed the image file in the report? Or what is the
best way to associate these two files so they can be e-mailed
together?
Tim Erickson
Signature Control SystemsTim,
Unfortunately, HTML does not include images.
A suggestion would be to create a GIF image, or to put everything in a zip file, or something to that effect.
I had to work with HTML documentation for LabVIEW, and actually used LabVIEW to substitute the images for control types with words, such that images were not required. You can try this if your images are nothing more than representations for which text can be substituted.
Alternatively, if your image is something like a graph, or the front panel, I might suggest creating a .gif or .jpg image out of it. This has to be done manually, but will make the page one single file.
Good luck, I hope that helps. -
Report with image / howto use nvl
HI to all,
i'm playing aroun with image inside a report:
I would like to use an nvl function with an image: here the code, taken from an example app:
select
"PHOTO_CATALOG_ID",
"PHOTO_NAME",
"DESCRIPTION",
"UPLOADED_ON",
"MIME_TYPE",
'<img src="#OWNER#.display_thumb?p_photo_id=' || nvl(PHOTO_CATALOG_ID,0) || ' "/ WIDTH=100 HEIGHT=100>' thumbnail
from "PHOTO_CATALOG"
where
instr(upper("PHOTO_NAME"),upper(nvl(:P1_REPORT_SEARCH,"PHOTO_NAME"))) > 0 or
instr(upper("DESCRIPTION"),upper(nvl(:P1_REPORT_SEARCH,"DESCRIPTION"))) > 0 or
instr(upper("MIME_TYPE"),upper(nvl(:P1_REPORT_SEARCH,"MIME_TYPE"))) > 0
I would like to have a fixed grid of image 6 col * 2 row: that's quite easy however what doesn't work is nvl(PHOTO_CATALOG_ID,0): i got a missing image, but image with photo_catalog_id=0 isn't taken at all.
For image =0 i've uploaded a white image.
Anywhere if someone has another solution / idea for making a thumbnail like app in apex, wasn't bad to hear...
However: i don't want a report with an image col. I want different image (let's say that i would like to have the grid 6col * 2 row) with pagination style.
Each image should stay in a row of image table.
Thanks a lotGuys,
i haven't seen there was album v2 on application express studio: maybe this is what i am looking for.
bye -
Create Report with Image on the backside of first page
Hi there,
I want to create a report with a header-section (including data and a barcode) and some data in the main section. The main section is diffing in length so that the report might be just one page or 4-5 pages or even more.
In addition I want to print an image on the backside of the first page.
The image exists in TIFF-Format and it should be printed in landscape, while the report itself is inmPortarit-Mode.
The report(s) should be printed automatically (without user-interaction).
Thanks for any ideas.
Mark RadermacherMark,
The reply could be a bit delayed and you might have got it working also.
All your requirtements are easily achieveable, you might want to look into the building reports samples and publishing reports documenation at
http://otn.oracle.com/docs/products/reports/content.html
Thanks
The Oracle Reports Team -
Interactive report with images
I looked at this link
http://apex.oracle.com/pls/otn/f?p=31517:1
I see that there are images in the report with a little link to download to excel at the bottom. What does the image look like when downloaded to excel?
Also is there a way to have an image in an interactive report but not have it download to excel, pdf, or word? I want to rest of the IR columns to be downloadable, just not the image.
Thanks,
AndrewHello Andrew,
If you tried the download link you would have seen that the images are not downloaded in Excel. That's because the download is a separate procedure that is called using the link.
When you look at [this page|http://htmldb.oracle.com/pls/otn/f?p=31517:108] you can see how Denes does that...
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-) -
Scheduling a webi report with no access to univ. connection
Hi,
I have a user in BO enterprise, who has access to a report, but no access to the universe & universe connection.
So ideally, the expected behavior is that, when the user schedules the report, the schedule should fail.
When I do a schedule, by clicking on the prompts, and modify, it throws me an error that the Universe and universe connection are not accessible.
But when I schedule the report, with all default settings (without modifying the prompt values), it schedules, and shows a Success status. (Though the report shows blank data)
Has anyone observed this before? Any info on this would be helpful.
Thanks.Hi,
The use-case is:
- An administrator creates a new user (by default belongs to Everyone group) and provides access to a particular report including the scheduling privileges
- The Everyone group does not have access for the Universe or the Connection
- When this user runs the report (View on Demand) and refreshes the data (via the Refresh Data button), the error is thrown stating that the universe is not found/not accessible.
- When scheduling the same report, we see different behaviors (one of the prompt option happens to be a List of Values:
- Changing the prompt values - Clicking the modify button on the parameters page and trying to select a value for the LoV prompt throws me the Universe not found/accessible error (which is correct as the concerned user does not have access to the universe or the connection)
- With default prompt values (i.e. not changing any of the prompt values in the parameters page) - This shows that the schedule was successful and when i open the instance, it shows me blank report - The question here is, why would the schedule succeed when the user does not have the access to the universe/connection?
Thanks -
Chandra -
Crystal Reports with images aren't displayed in the InfoView
Hi everybody,
I have a problem with my Crystal reports and its display in the info view. If the reports include images from the repository, the reports aren't displayed when hit in the BO-InfoView.
This errors does not occur if there are just images in the report. Only the combination of images, embedded XCelsius-SWFs and data from the defined data sources causes the problem.
Instead of the correct report, I get a white blank screen.
Versions:
Business Objects XI 3.0
Crystal Reports 12.0
Internet Explorer 6.0.29
Thanks for helping
SebastianHi everybody,
I installed version 3.1.
Problem is now solved. -
SSRS 2008 reports with images throw script error with IE9
When i try to load SSRS 2008 report in a browser or a application with browser control on machine which has IE9, it loads the image but throws some script error. I also tried installing the ReportViewer08 SP1.exe, but still i get the error.
The error is "Object doesnt support method or property"
In the script debugger i see debugger stuck at "this.Poll..." statement.
function anonymous()
this.PollResizeImages(oReportDiv, oReportDiv);I'm also getting this error when I run a report using ReportViewer control
on many environments including production for my customers
I have Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) Jun 17 2011 00:54:03 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build
7601: Service Pack 1) (Hypervisor)
Funny thing is another environment with same version doesn't ( internal )
doesn't get this error
Another symptom is that images when report is first run are cropped but
refreshing report or changing to another report page and back again the
issue doesn't occur -
Oracle Ad-hoc report with multiple queries creating issues
Hi Guys,
I have been having multiple issues (one after the other) in trying to generate a report for Business user. Let me start with my test cases and yes, this time I have made sure by testing and dirtying my hands that the test cases work properly and commit into the database (I will be more than happy to provide screen shots of the same).
Test Case:
Tables:RETURNS & RETURN_LINE_ITEMS
CREATE TABLE RETURNS
ID NUMBER(12),
PROG_PROGRAM_CD VARCHAR2(2 BYTE),
ACCT_ID NUMBER(12),
ACPE_ID NUMBER(12),
JENT_ID NUMBER(12),
PREV_RTRN_ID NUMBER(12),
ENTP_ABN NUMBER(9),
ACCT_OCCURNC_NBR NUMBER(4),
SOURCE_TYPE VARCHAR2(30 BYTE) DEFAULT 'BLANK',
RECEIVE_DATE DATE,
AMEND_IND VARCHAR2(1 BYTE) DEFAULT 'N',
CMPLT_IND VARCHAR2(1 BYTE) DEFAULT 'N',
PENALTY_OR_IND VARCHAR2(1 BYTE) DEFAULT 'N',
RETURN_STATUS VARCHAR2(12 BYTE),
STATUS_DATE DATE,
STATUS_USERID VARCHAR2(8 BYTE),
PERIOD_START_DATE DATE,
PERIOD_END_DATE DATE,
NOTICE_STATUS VARCHAR2(12 BYTE),
NOTICE_STATUS_DATE DATE,
NOTE_TEXT VARCHAR2(2000 BYTE),
PENALTY_OR_BY VARCHAR2(8 BYTE),
PENALTY_OR_TMST DATE,
FILING_ID NUMBER(12),
CASE_ID VARCHAR2(49 BYTE),
DOC_CONTRL_NBR NUMBER(29),
LOCTR_NBR NUMBER(10),
STATUTE_BARRED_DATE DATE,
MEDIA_TYPE VARCHAR2(30 BYTE),
DISPSTN_TYPE VARCHAR2(30 BYTE),
AMEND_TYPE VARCHAR2(30 BYTE),
CALC_MODE VARCHAR2(30 BYTE),
PROCESS_PASS_CNT NUMBER(1),
CONVRTD_IND VARCHAR2(1 BYTE) DEFAULT 'N',
LOSS_PERIOD_END_DATE DATE,
MF_SYNC_CD VARCHAR2(1 BYTE)
CREATE TABLE RETURN_LINE_ITEMS
ID NUMBER(12),
RTSC_ID NUMBER(12),
RTRN_ID NUMBER(12),
SCLI_ID NUMBER(12),
LITM_ID NUMBER(12),
ENTP_ABN NUMBER(9),
PROG_PROGRAM_CD VARCHAR2(2 BYTE),
ACCT_OCCURNC_NBR NUMBER(4),
ACPE_END_DATE DATE,
SCHED_NBR VARCHAR2(3 BYTE),
SCHD_VERSION_YR NUMBER(4) DEFAULT 0,
SCHD_VERSION_NBR NUMBER(3),
RTSC_OCCUR_NBR NUMBER(3),
LITM_LINE_ITEM_NBR VARCHAR2(3 BYTE),
SLIN_LINE_ITEM_ID NUMBER(12),
OCCUR_NBR NUMBER(3) DEFAULT 1,
PREV_VAL_MOD_IND VARCHAR2(1 BYTE) DEFAULT 'N',
VIABLE_IND VARCHAR2(1 BYTE) DEFAULT 'N',
ACTIVE_IND VARCHAR2(1 BYTE) DEFAULT 'Y',
ACTION_CD VARCHAR2(1 BYTE),
PREV_VAL_AMT NUMBER(15,2),
REVISE_VAL_AMT NUMBER(15,2),
PREV_VAL_TEXT VARCHAR2(100 BYTE),
REVISE_VAL_TEXT VARCHAR2(100 BYTE),
DISPLAY_SEQ_NBR NUMBER(3),
SYS_VAL_AMT NUMBER(15,2),
LITM_INNER_PASS_SEQ_NBR NUMBER(3)
Inserting data into RETURNS table
INSERT INTO RETURNS (
ID ,
PROG_PROGRAM_CD ,
ACCT_ID ,
ACPE_ID ,
JENT_ID ,
PREV_RTRN_ID ,
ENTP_ABN ,
ACCT_OCCURNC_NBR ,
SOURCE_TYPE ,
RECEIVE_DATE ,
AMEND_IND ,
CMPLT_IND ,
PENALTY_OR_IND ,
RETURN_STATUS ,
STATUS_DATE ,
STATUS_USERID ,
PERIOD_START_DATE ,
PERIOD_END_DATE ,
NOTICE_STATUS ,
NOTICE_STATUS_DATE ,
NOTE_TEXT ,
PENALTY_OR_BY ,
PENALTY_OR_TMST ,
FILING_ID ,
CASE_ID ,
DOC_CONTRL_NBR ,
LOCTR_NBR ,
STATUTE_BARRED_DATE ,
MEDIA_TYPE ,
DISPSTN_TYPE ,
AMEND_TYPE ,
CALC_MODE ,
PROCESS_PASS_CNT ,
CONVRTD_IND ,
LOSS_PERIOD_END_DATE ,
MF_SYNC_CD)
VALUES(
3715944,
'01',
139048,
3587419,
9518324,
NULL,
401377197,
1,
'TAXPAYER',
TO_DATE('4/7/2009','mm/dd/yyyy'),
'N',
'Y',
'N',
'ASSESSED',
TO_DATE('4/30/2009','mm/dd/yyyy'),
'TRAPROD2',
TO_DATE('2/1/2008','mm/dd/yyyy'),
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'PRINTED',
TO_DATE('4/30/2009' , 'mm/dd/yyyy'),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
6045574495,
NULL,
'RSI',
'NOTICE',
NULL,
NULL,
NULL,
'N',
NULL,
NULL);
NSERT INTO RETURNS (
ID ,
PROG_PROGRAM_CD ,
ACCT_ID ,
ACPE_ID ,
JENT_ID ,
PREV_RTRN_ID ,
ENTP_ABN ,
ACCT_OCCURNC_NBR ,
SOURCE_TYPE ,
RECEIVE_DATE ,
AMEND_IND ,
CMPLT_IND ,
PENALTY_OR_IND ,
RETURN_STATUS ,
STATUS_DATE ,
STATUS_USERID ,
PERIOD_START_DATE ,
PERIOD_END_DATE ,
NOTICE_STATUS ,
NOTICE_STATUS_DATE ,
NOTE_TEXT ,
PENALTY_OR_BY ,
PENALTY_OR_TMST ,
FILING_ID ,
CASE_ID ,
DOC_CONTRL_NBR ,
LOCTR_NBR ,
STATUTE_BARRED_DATE ,
MEDIA_TYPE ,
DISPSTN_TYPE ,
AMEND_TYPE ,
CALC_MODE ,
PROCESS_PASS_CNT ,
CONVRTD_IND ,
LOSS_PERIOD_END_DATE ,
MF_SYNC_CD)
VALUES(
4117092,
'01',
57794,
3864551,
10566221,
NULL,
400571410,
1,
'TAXPAYER',
TO_DATE('6/30/2010', 'mm/dd/yyyy'),
'N',
'Y',
'N',
'ASSESSED',
TO_DATE('7/27/2010','mm/dd/yyyy'),
'TRAPROD2',
TO_DATE('1/1/2009','mm/dd/yyyy'),
TO_DATE('12/31/2009','mm/dd/yyyy'),
'PRINTED',
TO_DATE('7/27/2010','mm/dd/yyyy'),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
6053117120,
NULL,
'RSI',
'NOTICE',
NULL,
NULL,
NULL,
'N',
NULL,
NULL);
INSERT INTO RETURNS (
ID ,
PROG_PROGRAM_CD ,
ACCT_ID ,
ACPE_ID ,
JENT_ID ,
PREV_RTRN_ID ,
ENTP_ABN ,
ACCT_OCCURNC_NBR ,
SOURCE_TYPE ,
RECEIVE_DATE ,
AMEND_IND ,
CMPLT_IND ,
PENALTY_OR_IND ,
RETURN_STATUS ,
STATUS_DATE ,
STATUS_USERID ,
PERIOD_START_DATE ,
PERIOD_END_DATE ,
NOTICE_STATUS ,
NOTICE_STATUS_DATE ,
NOTE_TEXT ,
PENALTY_OR_BY ,
PENALTY_OR_TMST ,
FILING_ID ,
CASE_ID ,
DOC_CONTRL_NBR ,
LOCTR_NBR ,
STATUTE_BARRED_DATE ,
MEDIA_TYPE ,
DISPSTN_TYPE ,
AMEND_TYPE ,
CALC_MODE ,
PROCESS_PASS_CNT ,
CONVRTD_IND ,
LOSS_PERIOD_END_DATE ,
MF_SYNC_CD)
VALUES(
4382179,
'01',
498210,
3957251,
11264174,
3727534,
405079963,
1,
'TAXPAYER',
TO_DATE('4/26/2011', 'mm/dd/yyyy'),
'Y',
'Y',
'N',
'ASSESSED',
TO_DATE('5/12/2011','mm/dd/yyyy'),
'LOPATS',
TO_DATE('2/1/2008', 'mm/dd/yyyy'),
TO_DATE('1/31/2009','mm/dd/yyyy'),
'PRINTED',
TO_DATE('5/12/2011','mm/dd/yyyy'),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
6058767341,
TO_DATE('4/30/2015','mm/dd/yyyy'),
'RSI',
'NOTICE',
'LOSS CARRY BACK (SIMPLE)',
'LOSS CARRY BACK',
NULL,
'N',
TO_DATE('1/31/2011', 'mm/dd/yyyy'),
NULL
Now inserting data into 2nd table i.e. RETURN_LINE_ITEMS
RTRN_ID means RETURN ID
This is for RTRN_ID =3715944
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES(
277707088,
8022477,
3715944,
NULL,
1585,
401377197,
'01',
1,
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'000',
1998,
1,
1,
'029',
23,
1,
'N',
'Y',
'Y',
NULL,
1,
1,
NULL,
NULL,
115,
1 ,
1);
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
277707106,
8022477,
3715944,
NULL,
1603,
401377197,
'01',
1,
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'000',
1998,
1,
1,
'062',
40,
1,
'N',
'Y',
'Y',
NULL,
1069336,
1069336,
NULL,
NULL,
200,
1069336,
130
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
(277707109,
8022477,
3715944,
NULL,
1539,
401377197,
'01',
1,
TO_DATE('1/31/2009','mm/dd/yyyy'),
'000',
1998,
1,
1,
'066',
43,
1,
'N',
'Y',
'Y',
NULL,
NULL,
1000,
'NULL',
'NULL',
215,
1069336,
200);Now for RTRN_ID = 4117092
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES(
319820214,
9028477,
4117092,
NULL,
1585,
400571410,
'01',
1,
TO_DATE('12/31/2009','mm/dd/yyyy'),
'000',
1998,
1,
1,
'029',
23,
1,
'N',
'Y',
'Y',
NULL,
3,
3,
NULL,
NULL,
115,
3,
1
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES(
319820233,
9028477,
4117092,
NULL,
1603,
400571410,
'01',
1,
TO_DATE('12/31/2009','mm/dd/yyyy'),
'000',
1998,
1,
1,
'062',
40,
1,
'N',
'Y',
'Y',
NULL,
790068,
790068,
NULL,
NULL,
200,
790068,
130
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
319820236,
9028477,
4117092,
NULL,
1539,
400571410,
'01',
1,
TO_DATE('12/31/2009','mm/dd/yyyy'),
'000',
1998,
1,
1,
'066',
43,
1,
'N',
'Y',
'Y',
NULL,
NULL,
790,
NULL,
NULL,
215,
790068,
200
Now finally for RTRN_ID = 4382179
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
348462584,
9694297,
4382179,
NULL,
1585,
405079963,
'01',
1,
TO_DATE(1/31/2009, 'mm/dd/yyyy'),
'000'
1998,
1,
1,
'029',
23,
1,
'N',
'Y',
'Y',
NULL,
1,
1,
NULL,
NULL,
115,
NULL,
1
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
348462602,
9694297,
4382179,
NULL,
1603,
405079963,
'01',
1,
TO_DATE('1/31/2009','mm/dd/yyyy'),
'000',
1998,
1,
1,
'062',
40,
1,
'N',
'Y',
'Y',
NULL,
672738,
643304,
NULL,
NULL,
200,
NULL,
130
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
348462605,
9694297,
4382179,
NULL,
1539,
405079963,
01,
1,
TO_DATE('1/31/2009','mm/dd/yyyy'),
'000',
1998,
1,
1,
'066',
43,
1,
'N',
'Y',
'Y',
NULL,
672738,
643304,
NULL,
NULL,
215,
643304,
200
);OK. Now once this data is all inserted, comes the real problem and that is:
a) based on the following requirements
Requirements: Adhoc Report for Audit on CIT Income Allocation
1. Select from the RETURNS table:
• Id > 3600000 and
• Prog_program_cd = '01' and
• Return_status in ('ASSESSED', 'DU") and
• Tax year ending in 2009 (i.e. year portion of the Period_end_date is in 2009)
2. Retrieve the following fields from the RETURNS table :
• Id
• Entp_abn
• Acct_id
• Prog_program_cd
• Period_start_date
• Period_end_date
• Amend_ind
• Return_status
• Status_date
• Loctr_nbr
3. If there are multiple entries from the same account and tax year, only retain the latest record: From the records selected in step 2, if there are multiple records with the same Acct_Id and Period_end_date, only retain the record with the most recent Status_date (i.e. MAX value on the date).
4. Using the results from step 3, link to the applicable RETURN_LINE_ITEMS table where:
• RETURNS.Id = RETURN_LINE_ITEMS.Rtrn_Id
5. From the selected return on RETURN_LINE_ITEMS table, retrieve records where (value on Sch 000 Line 062 > 500,000) and (value on Sch 000 Line 066 < value on Sch 000 Line 062) :
• Sched_nbr = '000', and Litm_line_item_nbr = '062', and Active_ind = 'Y', get Revise_val_amt as 'ab_taxable_income'
• Sched_nbr = '000', and Litm_line_item_nbr = '066', and Active_ind = 'Y', get Revise_val_amt as 'amt_taxable_in_ab'
• Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
I utilized the following query and I am getting 4 rows (line item numbers 062 and 066 where in ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income) and this is correct
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
from returns r1, return_line_items rtlnms
where
r1.id = rtlnms.rtrn_id and
r1.prog_program_cd = rtlnms.prog_program_cd and
r1.entp_abn = rtlnms.entp_abn and
r1.id > 3600000 AND r1.prog_program_cd = '01' AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and rtlnms.active_ind = 'Y'
and r1.id in (4117092,3715944,4382179,3691435)
and RTLNMS.LITM_LINE_ITEM_NBR IN('062')
AND nvl(decode(litm_line_item_nbr, '062', REVISE_VAL_AMT),0) > 500000
and NVL(RTLNMS.REVISE_VAL_AMT,0) >( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
FROM RETURN_LINE_ITEMS RTLNMS2
WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
AND RTLNMS2.LITM_LINE_ITEM_NBR = '066'
AND SCHED_NBR='000'
UNION
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
from returns r1, return_line_items rtlnms
where r1.id = rtlnms.rtrn_id
AND r1.prog_program_cd = rtlnms.prog_program_cd
AND r1.entp_abn = rtlnms.entp_abn
AND r1.id > 3600000 AND r1.prog_program_cd = '01'
AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and rtlnms.active_ind = 'Y'
and r1.id in (4117092,3715944,4382179,3691435)
and RTLNMS.LITM_LINE_ITEM_NBR IN('066')
and NVL(RTLNMS.REVISE_VAL_AMT,0) <( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
FROM RETURN_LINE_ITEMS RTLNMS2
WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
AND RTLNMS2.LITM_LINE_ITEM_NBR = '062'
and NVL(RTLNMS2.REVISE_VAL_AMT,0)>500000
AND SCHED_NBR='000'
order by IDHowever there is another condition after "5c" i.e. after Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
and that is:
For those returns meeting the criteria in step 5, also retrieve the following from RETURN_LINE_ITEMS table and that is:
sched_nbr = '000' and Litm_line_item_nbr = '029' and ACTIVE_IND ='Y', get Revise_val_amt as "corp_type"
and in order to go about this, I utilised the following query:
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB,
decode(rtlnms.litm_line_item_nbr, '029', RTLNMS.REVISE_VAL_AMT)CORP_INCOME
from returns r1, return_line_items rtlnms
where
r1.id = rtlnms.rtrn_id and
r1.prog_program_cd = rtlnms.prog_program_cd and
r1.entp_abn = rtlnms.entp_abn and
r1.id > 3600000 AND r1.prog_program_cd = '01' AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and rtlnms.active_ind = 'Y'
and r1.id in (4117092,3715944,4382179,3691435)
and RTLNMS.LITM_LINE_ITEM_NBR IN('062')
AND nvl(decode(litm_line_item_nbr, '062', REVISE_VAL_AMT),0) > 500000
and NVL(RTLNMS.REVISE_VAL_AMT,0) >( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
FROM RETURN_LINE_ITEMS RTLNMS2
WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
AND RTLNMS2.LITM_LINE_ITEM_NBR IN( '066')
AND SCHED_NBR='000'
UNION
SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
decode(rtlnms.litm_line_item_nbr, '062', RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
decode(rtlnms.litm_line_item_nbr, '066', RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB,
decode(rtlnms.litm_line_item_nbr, '029', RTLNMS.REVISE_VAL_AMT)CORP_INCOME
from returns r1, return_line_items rtlnms
where r1.id = rtlnms.rtrn_id
AND r1.prog_program_cd = rtlnms.prog_program_cd
AND r1.entp_abn = rtlnms.entp_abn
AND r1.id > 3600000 AND r1.prog_program_cd = '01'
AND r1.return_status in ('ASSESSED', 'DU')
and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
and rtlnms.sched_nbr = '000'
and rtlnms.active_ind = 'Y'
and r1.id in (4117092,3715944,4382179,3691435)
and RTLNMS.LITM_LINE_ITEM_NBR IN('066','029')
and NVL(RTLNMS.REVISE_VAL_AMT,0) < ( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
FROM RETURN_LINE_ITEMS RTLNMS2
WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
AND RTLNMS2.LITM_LINE_ITEM_NBR='062'
and NVL(RTLNMS2.REVISE_VAL_AMT,0)>500000
AND SCHED_NBR='000'
order by ID
My output is: 7 rows i.e.
3 rows of return id = 3715944,
3 rows of return id = 4117092
and 1 row of return id = 4382179
It should only retrieve rows for 3715944 and 4117092; not for row =4382179 and this is because based on question in 5 "c", rows retrieved were for return ids' = 3715944 and 4117092
I know where the problem is:
As soon as it retrieves rows for returns 3715944 and 4117092 (because REVISE_VAL_AMT is greater than 500,000), it also finds another record with return id = 4382179 with greater than 500,000 and it blindly brings that as well.
Is there a way around to ensure that I my results are compared only against the return id's retrieved from 5 "c" = 3715944 and 4117092
Believe me I have tried every option that I could think of to remove return id = 4382179 but somehow could not.
Dear Gurus @ OTN, please help me.
Thanks,
SandeepThanks for your words of wisdom guys. Appreciate it.
Anyways what ever I asked, I was able to get solution for it by using an inline query and it's as follows:
SELECT id, entp_abn, acct_id, prog_program_cd, period_start_date,
period_end_date, amend_ind, return_status, status_date, loctr_nbr,
ab_taxable_income, amt_taxable_in_ab
FROM (SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,
r1.period_start_date, r1.period_end_date, r1.amend_ind,
r1.return_status, r1.status_date, r1.loctr_nbr,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'062', rtlnms.revise_val_amt)) ab_taxable_income,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'066', rtlnms.revise_val_amt)) amt_taxable_in_ab
FROM returns r1, return_line_items rtlnms
WHERE r1.id = rtlnms.rtrn_id
AND r1.id > 3600000
AND r1.prog_program_cd = '01'
AND r1.return_status IN ('ASSESSED', 'DU')
AND r1.period_end_date BETWEEN
TO_DATE ('01-01-2009', 'DD-MM-YYYY') AND
TO_DATE ('31-12-2009', 'DD-MM-YYYY')
AND rtlnms.sched_nbr = '000'
AND rtlnms.active_ind = 'Y'
AND r1.status_date =
(SELECT MAX (status_date)
FROM returns r2
WHERE r2. acct_id= r1.acct_id
AND r2.period_end_date = r1.period_end_date)
GROUP BY r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,
r1.period_start_date, r1.period_end_date, r1.amend_ind,
r1.return_status, r1.status_date, r1.loctr_nbr)
WHERE ab_taxable_income > 500000
AND amt_taxable_in_ab < ab_taxable_income
ORDER BY id
*OUTPUT*
ID ENTP_ABN ACCT_ID PR PERIOD_ST PERIOD_EN A RETURN_STATU STATUS_DA LOCTR_NBR AB_TAXABLE_INCOME AMT_TAXABLE_IN_AB
3715944 401377197 139048 01 01-FEB-08 31-JAN-09 N ASSESSED 30-APR-09 6045574495 1069336 1000
4117092 400571410 57794 01 01-JAN-09 31-DEC-09 N ASSESSED 27-JUL-10 6053117120 790068 790
2 rows selected.Anyways I am stuck in another issue and that is:
Based on what I have received above - I have been given a new requirement and that is:
retrieve the corresponding Schedule 002 data (if exist) from the RETURN_LINE_ITEMS table:
*• Sched_nbr = ‘002’, and Litm_line_item_nbr = ‘001’, and Active_ind = ‘Y’, get Revise_val_amt as ‘special_allocation’*
*• Sched_nbr = ‘002’, and Litm_line_item_nbr = ‘002’, and Active_ind = ‘Y’, get Revise_val_amt as ‘ab_salaries_wages’*
So in order to do this, I committed 5 additional rows with schedule number 002 and they are as follows:
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
626121,
118320,
3715944,
NULL,
2322,
401377197,
'01',
1,
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'002',
1981,
1,
1,
'001',
78,
1,
'N',
'Y',
'Y',
NULL,
NULL,
NULL,
NULL,
NULL,
5,
NULL,
40
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
626121,
118320,
3715944,
NULL,
2322,
401377197,
'01',
1,
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'002',
1981,
1,
1,
'002',
78,
1,
'N',
'Y',
'Y',
NULL,
NULL,
NULL,
NULL,
NULL,
5,
NULL,
40
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
626121,
118320,
3715944,
NULL,
2322,
401377197,
'01',
1,
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'002',
1981,
1,
1,
'004',
78,
1,
'N',
'Y',
'Y',
NULL,
NULL,
NULL,
NULL,
NULL,
5,
NULL,
40
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
626121,
118320,
3715944,
NULL,
2322,
401377197,
'01',
1,
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'002',
1981,
1,
1,
'006',
78,
1,
'N',
'Y',
'Y',
NULL,
NULL,
NULL,
NULL,
NULL,
5,
NULL,
40
INSERT INTO RETURN_LINE_ITEMS (
ID ,
RTSC_ID ,
RTRN_ID ,
SCLI_ID ,
LITM_ID ,
ENTP_ABN ,
PROG_PROGRAM_CD ,
ACCT_OCCURNC_NBR ,
ACPE_END_DATE ,
SCHED_NBR ,
SCHD_VERSION_YR ,
SCHD_VERSION_NBR ,
RTSC_OCCUR_NBR ,
LITM_LINE_ITEM_NBR ,
SLIN_LINE_ITEM_ID ,
OCCUR_NBR ,
PREV_VAL_MOD_IND ,
VIABLE_IND ,
ACTIVE_IND ,
ACTION_CD ,
PREV_VAL_AMT ,
REVISE_VAL_AMT ,
PREV_VAL_TEXT ,
REVISE_VAL_TEXT ,
DISPLAY_SEQ_NBR ,
SYS_VAL_AMT ,
LITM_INNER_PASS_SEQ_NBR
VALUES
626121,
118320,
3715944,
NULL,
2322,
401377197,
'01',
1,
TO_DATE('1/31/2009', 'mm/dd/yyyy'),
'002',
1981,
1,
1,
'008',
78,
1,
'N',
'Y',
'Y',
NULL,
NULL,
NULL,
NULL,
NULL,
5,
NULL,
40
); So based on the requirement I ran the following query in the hope that I should see 8 records but unfortunately I saw none, Can any one help again please??? The query is as follows:
SELECT id, entp_abn, acct_id, prog_program_cd, period_start_date,
period_end_date, amend_ind, return_status, status_date, loctr_nbr,
ab_taxable_income, amt_taxable_in_ab,
CORP_INCOME, AB_ALLOC_FACTOR, AB_TAX_PAYABLE,
special_allocation, ab_salaries_wages
FROM (SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,
r1.period_start_date, r1.period_end_date, r1.amend_ind,
r1.return_status, r1.status_date, r1.loctr_nbr,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'062', rtlnms.revise_val_amt)) ab_taxable_income,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'066', rtlnms.revise_val_amt)) amt_taxable_in_ab,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'029', rtlnms.revise_val_amt)) CORP_INCOME,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'065', rtlnms.revise_val_amt)) AB_ALLOC_FACTOR,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'080', rtlnms.revise_val_amt)) AB_TAX_PAYABLE,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'001', rtlnms.revise_val_amt)) SPECIAL_ALLOCATION,
SUM
(DECODE
(rtlnms.litm_line_item_nbr,
'002', rtlnms.revise_val_amt)) AB_SALARIES_WAGES
FROM returns r1, return_line_items rtlnms
WHERE r1.id = rtlnms.rtrn_id
AND r1.id > 3600000
AND r1.prog_program_cd = '01'
AND r1.return_status IN ('ASSESSED', 'DU')
AND r1.period_end_date BETWEEN
TO_DATE ('01-01-2009', 'DD-MM-YYYY') AND
TO_DATE ('31-12-2009', 'DD-MM-YYYY')
AND rtlnms.sched_nbr = '000'
AND(rtlnms.sched_nbr = '002' and rtlnms.litm_line_item_nbr in ('001','002','004','006','008') )
AND rtlnms.active_ind = 'Y'
AND r1.status_date =
(SELECT MAX (status_date)
FROM returns r2
WHERE r2. acct_id= r1.acct_id
AND r2.period_end_date = r1.period_end_date)
GROUP BY r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,
r1.period_start_date, r1.period_end_date, r1.amend_ind,
r1.return_status, r1.status_date, r1.loctr_nbr, rtlnms.sched_nbr)
WHERE ab_taxable_income > 500000
AND amt_taxable_in_ab < ab_taxable_income
strangely it's not retrieving any row where as it should have retrieved one row atleast and that is all records pertaining to return_id (return id ) = 3715944
Can any of the Gurus' please help me out? As said I am really having a bad day on this. Many thanks to any one who can help me see the light today :-) -
Problem printing Report with Image in BI Publisher 11g
I am working with BI publisher *11g* but I have problem printing images. Everything works fine if I do not include any images however when I add a image I get following problems.
When I tried printing PDF in output I get
Type /Xobject
subtype /Image
Filter /DTDDecode .......
When I tried printing HTML output I get
Type /Xobject
<html...
....>
When I tried printing RTF I get
{ \fontb1 }
{ \f0 Arial;}
{ \f1 Times:}
I think I am missing some BI publisher configuration. Can you help me in this regard.
Thanks,
Santosh
Edited by: user4956795 on Jan 16, 2012 2:08 PM
Edited by: user4956795 on Jan 16, 2012 2:18 PMIsn't there a way for you to do this via a Package/Procedure versus having multiple queries?
Per the BI Publisher guide,
Following are recommended guidelines for building data models:
Reduce the number of data sets or queries in your data model as much as possible. In general, the fewer data sets and queries you have, the faster your data model will run. While multiquery data models are often easier to understand, single-query data models tend to execute more quickly. It is important to understand that in parent-child queries, for every parent, the child query is executed.
You should only use multiquery data models in the following scenarios:
To perform functions that the query type, such as a SQL query, does not support directly.
To support complex views (for example, distributed queries or GROUP BY queries).
To simulate a view when you do not have or want to use a view.
Thanks,
Bipuser -
UCCX 9.0(2) Custom reports with CUIC 9.0 issue
Hello.
I installed in our lab UCCX 9.0(2) and CUIC 9.0(1) with premium licenses. It's necessary for making custom reports used in CUIC.
I found this document:
http://www.cisco.com/en/US/partner/docs/voice_ip_comm/cust_contact/contact_center/crs/express_9_02/programming/guide/UCCX_BK_CFD16E30_00_cisco-unified-contact-center-express_chapter_0100.html and tryed make recomendations from it.
But I had a problem with prerequisites #6. I can't click "Edit" button, because it is inactive. I attach 2 screenshots: from pages "Datasource" and user configuration.
What could be the problem?
Regards,
AntonHere's a summary so far:
Problem Description:
Unable to edit Data Source "UCCX" in co-resident CUIC.
Also, documentation required on CUIC Custom Reports.
Topology:
UCCX 9.0(2)
Resolution Summary:
Switched back to HRC, and then back to CUIC again. Datasource could be edited.
See the following sections of the CUIC user guide:
http://tools.cisco.com/squish/cddf8
Page 50, "Custom Templates" and "Reports and Report Definitions".
Page 107, "Report Definitions". -
Populating webi reports with images downloaded live from external sites
I'm writing applications to create different visualizations of my data, and would like the resulting images to show up in webi reports. Specifically, the application that draws the visualization will be deployed to the same java application server as webi. Users will open a normal webi report which will contain something like an HTML <img href="#myhref" /> tag, where #myhref will be a link to a page in my web application that draws a visualization.; Is such a thing possible, and if so, how? Many thanks, in advance.
Nevermind... I think I got it. I created a SQL query that would return the URL I wanted (something like SELECT 'http://server/context?param1=' || field1 || '¶m2=' || field2 FROM table", and then modified the resulting cell to be read as an Image URL.
Maybe you are looking for
-
How to get cm:search to use the max attribute when creating the SQL query?
When we use the max attribute in the cm:search tag, it does not seem to honor the max attribute when creating the SQL query. However, the result returned from the tag is limited to the number specified by the max attribute. Then the tag seems to work
-
Panorama feature not working in iOS 7
I have iPhone 5 Updated to iOS7 yesterday.Everything seems fine except the panorama feature for lock screen and home screen is not working for me.Help!!
-
Printing crashes in 10.8.2
During the past week, without my having made any hardware or software changes, my MacBook Pro has crashed every time I have attempted to print any document. The crashing occurs in Preview and in Pages '09 with any and all documents I have tried. I ha
-
Purchase Requisition restriction at Material Type level
Hi MM Guru's as per Client requirment we want to restrict the Purchase Requisition creation at Material type level (i.e system should raise the error messege when we try to create the PR against Finished Goods) is that possible if yes how can we rest
-
How to set RMAN Backup destinaion
I am configuring RMAN and do following steps Install 11gr2 software and create database Create rman user, tablespace and repository Register my two DB's on two different servers Then i run following script, after logging into one of DB as target (rma