How to Load CSV file into Apex 5 for particular columns? - oracle

I have table with three columns x (Foreign Key),y(Primary Key),z and also csv file with only two columns data y,z as shown in images http://imgur.com/a/12ENZ (Please copy and paste link)which has to uploaded into table.Here I fill x column for all the rows with constant value ‘20’.i have used Data loading wizard to do this in Apex 5.
Problem:
In the first step I loaded this table and then In next step you can see that I have to do column mapping .Here I get only two columns y(Mileage),z(Ratio) because I have only two columns in the excel and first column x i want to map with null values here(Problem 1).
In the next step I have added process in the Datavalidation to update column x to fill that constant value as shown in images. But you could see p_attr_number =1 makes first column to be updated with 20 value.Here I need my first column x to be filled with constant value 20(Problem 2).Please Give me some suggestions on this for solving this problems.

for problem 1 you can choose x column as nullable yes by editing your colum in object browser -> your table -> modify column -> nullabe field to NULL (do not reguire a value) so when you upload data it will not fill third column if you map 2 columns (althıugh you do not see the column name in wizards)
for problem 2 i am assuming that all fields in your database has data so you you can add a page process for giving new values to the uploaded data which has null x columns
1 go to 4th page 'Data Load Results' which created by data wizard
2 click add a page process button
3 choose pl/sql
4 give a name and choose on submit - after computations and validations
5 enter an update command which suits your needs as below
update your_table_name
set
x=20
where x is null;
6 write your success messages
7 choose finish button in option "when button presses"
8 create process
9 add a Branch button in Branches
10 give a name click next
11 enter the page you want to go after data load
12 choose finish button in option "when button presses"
13 go to finish button and choose submit in Action When Button Clicked -> action
by adding this process and branch
1st system will insert data to table
2nd it will update all the null x values to the static values in your table
3rd it will return to the page you want

Related

How to increase number of displayed rows in a tabular form using apex 5.0

Currently my tabular form displays 10 rows at a time. How do I increase the number of rows to be displayed, say from the current default number of 10 to something like 20? Is there a place somewhere in the page attribute where you can set the number of rows to be displayed, as in the case of an interactive report?
Region -> Attributes -> Layout -> Number of Rows
In scripting window you will find a drop-down with row label, select it and choose the number of rows you want to display.
If you are facing this problem for an 11g Oracle SQL Developer:
More than 10 rows available. Increase rows selector to view more rows.
Then you can directly solve this from drop down menu of rows situated beside Autocommit checkmark from SQL Workshop:
select 1000000 to show more rows :
Run those queries again!
Final Result having 21 rows in result :
This might have solve your problem!
You can call function
javascript:apex.widget.tabular.addRow();
N number of times per click... For example,
Generate 2 rows, call
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();
Generate 4 rows, call
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();
javascript:apex.widget.tabular.addRow();

Oracle Apex: Aggregate show as top row

Currently I use interactive report of Oracle Apex
Column1 Column2
A1 1 2
A2 2 3
A3 3 4
A4 4 5
----------------------
10 14
After showing data, I do some calculation such as sum Column1, Column2 using aggregate function SUM of interactive report
But the result show as the last row of report so I have to scroll to see the result.
How can I show the result as the first row of report?
Column1 Column2
10 14
----------------------
A1 1 2
A2 2 3
A3 3 4
A4 4 5
This can be done using JavaScript/jQuery (of course this is only one of many ways this can be done, but it works).
The SQL statement that is used to create the report along with all the filter and search information is stored in
WWV_FLOW_WORKSHEET tables
Create a database package to generate that SQL and sum the columns that you want from that and return as XML.
Call that database package from a jQuery AJAX call then parse the XML and using jQuery add a row to the top (and bottom if you like) of the worksheet table and place the results there.
The JavaScript/jQuery function should be called from an after refresh dynamic action for the worksheet in question.
function htmldbIRTotals(worksheet,columnList) {
sessionId = $("#pInstance").val();
worksheetId = $(worksheet.triggeringElement).find(".a-IRR-table:last").attr("id");
baseReportId=parseInt("0"+$("#"+worksheetId+"_rpt_saved_reports").val());
u="'||pkg||'.getTotals?p_worksheet_id="+worksheetId+"&p_base_Report_Id="+baseReportId+"&p_session_id="+sessionId+"&p_columns="+columnList;
$.post(u,function(data) {
var xml = $.parseXML(data);
});
With sessionId, worksheetId, and baseReportId you can retrieve all the info you need
columnList is a colon separated list of the columns that you want to total
You could even get more fancy and add different agregates (i.e. AVG, MIN, MAX etc.)
Example of this at the link below.
http://apps.htmldb.com/apps/f?p=htmldb:knowledgebase:::NO:RP:P5_ID:84315
The problem is that the totals may or may not be rendered on the page depending on the page size and the number of records in the result set - so with an Interactive Report, unless you force it to always show All Records, the page might not even be able to use JS tricks to move the summary line to the top.
My preference in this sort of situation is to add a separate region to the page based on a simple SQL query. It will be shown above the interactive report. Unfortunately the columns won't be aligned, however.
I found the solution
Add sub query to calculate the sum
Union with existed result
Use highlight function to make up the new row

How to count the no of lines in a particular cell in a table column through PL/SQL

Oracle >> How to count the no of lines entered in a cell in table, because i want to restrict maximum line for a customer. friends kindly give some suggestions to execute this command with SQL and PL/SQL..
Create a validation on that page that runs when query exists.
Add this query changing P1_item with the name of your page item:
SELECT 1 from dual where length(:P1_item) - length(REPLACE(:P1_item, chr(10), ''))>10
Using this when you submit the page if there are more than 10 new lines in your page item the validation will popup an error.

How to Repeat table in one report side

I have a simple report (1 Table with 2 small columns)
the report works fine but now I'm trying to repeat the table on the same page but I can't find an example on how to do this.
I also crosses only one question about this problem, so maybe I miss something obviously on how to solve this.
Could somebody please enlight me?
You can 'play' with (a single) Tablix details to simulate table repetition.
For example you can create 3 rows of details like this:
row 1: header
row 2: value
row 3: footer space
To obtain a result like this:
You can also use a different layout, for example:
row 1: label/value for column 1
row 2: label/value for column 2
row 3: footer space
If you have a very small table you can also set report columns to fill horizontal space.
This is the result (simulating table repetitions but you can also use a simple Tablix with standard header/details):
This is the result if you use columns and a simple Tablix with standard header/details:

increment the value of id in windows application(net) through database

if i click a button the last value in id should be incremented and displayed in the textbox in windows application(.net).
eg..
in database there are 10 records... in the column id from 1 to 10... if i click the button
the value should be increment and 11 should be shown in my textbox in windows application..
please send as soon as possibe
You need to specify that the ID column in your DB is an "identity" column. Then, when you insert a new record into the table, SQL will automatically assign the new record with the previous highest value in that column incremented appropriately (you can have SQL increment by 1 or more if you wish).
David Hayden wrote up a nice little article on this very subjectlink text:
http://www.davidhayden.com/blog/dave/archive/2006/02/16/2803.aspx

Resources