Display results of SQL in an HTML Block
Hi there
I want to display the results of some SQL within an HTML Block. To do this I have created a hidden page item which I can then reference within the HTML Block (ie: &mypageitem.)
However I want to run a process that assigns that page item the results of a simple SQL query that returns multiple rows. If I try to do that SQL within the page item itself it only assumes the value of the first row returned. I tried to do it within a pl/sql process and looping through a cursor and assigning my page item each row of the cursor. That didnt work because I couldnt insert an HTML BR within the page item and it only seemed to return one row.
Am I going about this the wrong way? Thanks in advance for any help.
Message was edited by:
user559162
Hi,
Firstly, you should declare a VARCHAR2 variable to hold the output. Secondly, when looping through the data, you should append each row's data to this string. Each line can be terminated using CHR(13) to get the new line. Finally, you set the field's value to the variable:
DECLARE
vOutput VARCHAR2(4000);
cursor definition etc
BEGIN
vOutput := '';
open the cursor...;
LOOP
vOutput := vOutput || rowdata || CHR(13);
END LOOP;
:mypageitem := vOutput;
END;
Regards
Andy
Similar Messages
-
How to compare result from sql query with data writen in html input tag?
how to compare result
from sql query with data
writen in html input tag?
I need to compare
user and password in html form
with all user and password in database
how to do this?
or put the resulr from sql query
in array
please help me?Hi dejani
first get the user name and password enter by the user
using
String sUsername=request.getParameter("name of the textfield");
String sPassword=request.getParameter("name of the textfield");
after executeQuery() statement
int exist=0;
while(rs.next())
String sUserId= rs.getString("username");
String sPass_wd= rs.getString("password");
if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
exist=1;
if(exist==1)
out.println("user exist");
else
out.println("not exist"); -
Unable to display results of multiple query in grid in Oracle SQL Developer
Hi, I am a newbie to this forum and couldn't find the Oracle SQL Developer forum so posting it here.
My question: How to display multiple query results in grid in Oracle SQL Developer.
Example:
select * from Employee;
select * from Department;
- when I select both the queries and hit F5 in Oracle sql developer. By default it displays in output window.
- How to display result of both the queries in Grid.
Any thoughts on this would be really helpful.
Thanks in advance.
HarshHi Harsh,
I'd say that the Results grid is designed to only show the results of 1 query at a time. I don't know/can't see how it would display multiple queries at a time.
I would suggest either joining your tables to create a single query or opening another SQL Worksheet for one of the queries so that you can display the results side-by-side.
Maybe you could explain what you're trying to do. Why are you trying to display multiple results in the same query grid? -
I want to display BLOB image in JSP Using html tags IMG src=
GoodAfternoon Sir/Madom
I Have got the image from oracle database but want to display BLOB image using <IMG src="" > Html tags in JSP page . If it is possible than please give some ideas or
Send me sample codes for display image.
This code is ok and working no problem here Please send me code How to display using html tag from oracle in JSP page.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="javax.swing.ImageIcon;" %>
<%
out.print("hiiiiiii") ;
// declare a connection by using Connection interface
Connection connection = null;
/* Create string of connection url within specified format with machine
name, port number and database name. Here machine name id localhost
and database name is student. */
String connectionURL = "jdbc:oracle:thin:@localhost:1521:orcl";
/*declare a resultSet that works as a table resulted by execute a specified
sql query. */
ResultSet rs = null;
// Declare statement.
PreparedStatement psmnt = null;
// declare InputStream object to store binary stream of given image.
InputStream sImage;
try {
// Load JDBC driver "com.mysql.jdbc.Driver"
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
/* Create a connection by using getConnection() method that takes
parameters of string type connection url, user name and password to
connect to database. */
connection = DriverManager.getConnection(connectionURL, "scott", "root");
/* prepareStatement() is used for create statement object that is
used for sending sql statements to the specified database. */
psmnt = connection.prepareStatement("SELECT image FROM img WHERE id = ?");
psmnt.setString(1, "10");
rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
int size=0;
sImage = rs.getBinaryStream(1);
//response.reset();
response.setContentType("image/jpeg");
while((size=sImage.read(bytearray))!= -1 ){
response.getOutputStream().write(bytearray,0,size);
catch(Exception ex){
out.println("error :"+ex);
finally {
// close all the connections.
rs.close();
psmnt.close();
connection.close();
%>
ThanksI have done exactly that in one of my applications.
I have extracted the image from the database as a byte array, and displayed it using a servlet.
Here is the method in the servlet which does the displaying:
(since I'm writing one byte at a time, it's probably not terribly efficient but it works)
private void sendImage(byte[] bytes, HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletOutputStream sout = response.getOutputStream();
for(int n = 0; n < bytes.length; n++) {
sout.write(bytes[n]);
sout.flush();
sout.close();
}Then in my JSP, I use this:
<img src="/path-to-servlet/image.jpg"/>
The name of the image to display is in the URL as well as the path to the servlet. The servlet will therefore need to extract the image name from the url and call the database. -
SQL queries inside html region
Hi,
I have html page in my application and i need to display result of the sql query inside this page. I would like to know if i can use the sql queries in html and if yes how can do that.
My query is select count(*) from Quote Letter master where service = 'Premier Support'
And i have similar queries like this which i would like to use in the html region.
Thank you,
rakeshrakesh119 wrote:
Hi,
I have html page in my application and i need to display result of the sql query inside this page. I would like to know if i can use the sql queries in html and if yes how can do that.You cannot/should not write sql queries in your html, but in APEX there are different ways to achieve this such as Page Items, PL/SQL Dynamic Content Region etc.
My query is select count(*) from Quote Letter master where service = 'Premier Support'.For this you better use a page item and compute the items value using a page computation on on-load before header point. Then you can place the page items in a APEX region and also add any styling -
Conditional display in a SQL-Report/Report Region
Hi,
here I have an example for "Conditional display in a SQL-Report/Report Region". I figured it out in Firefox 3.6.2 using Firebug as development tool on Apex 3.2.1.00.12.
First you have to put the following javascript code in the Page HTML-Header:
<script type="text/javascript">
<!--
// SOURCE
// W:\oracle\PRJ DWLS\javascript.07.js
// Beispiel Funktion zur bedingten Formatierung einer Tabellenzelle.
// Help (Substitution Strings):
// http://htmldb.oracle.com/pls/otn/wwv_flow_help.show_help?p_lang=de&p_session=2412201185523196&p_flow_id=4003&p_step_id=420,4003
// HTML Expression:
// <script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#DFT_COND1#
function ex_conditional_td
( p_id
, p_rownum
, p_cellnum
var l_td;
l_td = vd_getColumn(p_id, p_rownum, p_cellnum);
// hier die Bedingung definieren
if (true) {
l_td.style.color = '#808080';
} // -- eof ex_conditional_td -- //
// Beispiel Funktion zum Abstellen der onMouse Funktionalität der Tabellenzeile
// HTML Expression:
// <script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#DFT_ID#"
function ex_conditional_tr
( p_id
, p_rownum
var l_tr; // TABLE.TR
var l_td; // TABLE.TR.TD
if (true) {
l_tr = vd_getRow(p_id, p_rownum);
l_tr.onmouseover = null;
l_tr.onmouseout = null;
for (var i=0; i<l_tr.cells.length; i++) {
l_td = l_tr.cells;
l_td.style.backgroundColor = '#DDDDDD';
} // -- eof ex_conditional_tr() -- //
var g_DEBUG = false;
var g_TBODY = null;
// Liefert das Body-Element der Tabelle mit der ID <p_id>.
// Parameter
// p_id - die Id der HTML-Tabelle
// Return
// das Body-Element oder NULL, wenn die Zeile nicht gefunden wurde
function vd_getBody
( p_id
if (g_TBODY == null) {
var l_table = null;
l_table = document.getElementById( p_id );
if (l_table == null) {
l_table = document.getElementByName( p_id );
if (l_table != null) {
if (vd_debug()) {
alert("Tabelle gefunden, " + l_table.nodeName);
g_TBODY = vd_search( l_table, 'TD', 't10data', 'TBODY');
return g_TBODY;
} // -- eof vd_getBody() -- //
// Liefert die Zeile <p_rownum> der HTML-Tabelle mit der Id <p_id>.
// Parameter
// p_id - die Id der HTML-Tabelle
// p_rownum - die Zeilennummer
// Return
// die Zeile oder NULL, wenn die Zeile nicht gefunden wurde
function vd_getRow
( p_id
, p_rownum
var l_body = vd_getBody(p_id);
if ( l_body != null
&& l_body.nodeName == 'TBODY'
&& l_body.children[p_rownum].nodeName == 'TR') {
return l_body.children[p_rownum];
else {
return null;
} // -- eof vd_getRow() -- //
// Liefert die Spalte <p_column> der Zeile <p_rownum> der HTML-Tabelle mit der
// Id <p_id>.
// Parameter
// p_id - die Id der HTML-Tabelle
// p_rownum - die Zeilennummer
// p_column - der Index der Spalte / Zelle
// Return
// die Zelle oder NULL, wenn die Zelle nicht gefunden wurde
function vd_getColumn
( p_id
, p_rownum
, p_column
var l_tr = vd_getRow(p_id, p_rownum);
if ( l_tr != null
&& l_tr.nodeName == 'TR'
&& l_tr.children.length >= p_column
&& l_tr.children[p_column].nodeName == 'TD') {
return l_tr.children[p_column];
else {
return null;
} // -- eof vd_getColumn() -- //
// Rekursives Suchen nach einem Node.
// Zweck: Das bedingte Formatieren einer Tabellenzelle in einem Apex Standard
// SQL-Report.
// Diese Funktion durchsucht rekursiv, ab einem Ausgangsknoten <p_node>, alle
// darunter befindlichen Elemente, ob in dem Element <p_seachIn> sich die
// Klasse <p_class> befindet.
// Bei Standard-Reports ist die Reportzelle (TD) mit der Klasse
// "t10data" formatiert.
// Zunächst muss dazu die Tabellenzelle (TD) selbst, die übergeordnete
// Tabellenzeile (TR), der Tabellenbody (TBODY) oder die Tabelle (TABLE)
// selbst ermittelt werden.
// Der Beispielaufruf:
// var l_body;
// var l_node = document.getElementById( 'R112233' );
// l_body = search( l_node, 'TD', 't10data', 'TBODY');
// durchsucht also das mit der Id "R112233" versehene Element [der Report, für
// den in Apex eine statischen ID vergeben werden musste] rekursiv, bis er
// die [erste] Tabellenzelle "TD" findet, die als Klasse "t10data"
// definiert hat. Für diese ermittelt er dann das übergeordnete TBODY-Element.
// Parameter
// p_node - das Ausgangselement
// p_searchIn - der Knotenname, der durchsucht werden soll
// [node.nodeName == p_searchIn]
// p_class - der Name der CSS Klasse
// [node.classList[<index>] == p_class
// p_parentName - der Name [node.parentNode.nodeName == p_parentName]
// des Elements, das zurückgeliefert werden soll. Wird als
// p_parentName der Suchname p_searchIn angegeben, wird
// das Element selbst zurückgegeben.
// Return
// das per p_parentName gesuchte Element (TD, TR, TBODY, TABLE)
function vd_search
( p_node
, p_searchIn
, p_class
, p_parentName
var LN = "vd_search";
var l_element = null;
// DEBUG
if (vd_debug()) {
alert(LN + ":" + "Untersuche " + p_node.nodeName + ", id=" + p_node.id);
// 1) der aktuelle Knoten ist der, der durchsucht werden soll
if (p_node.nodeName == p_searchIn) {
if (p_node.classList.length > 0) {
for(var c=0; c<p_node.classList.length; c++) {
if (p_node.classList[c] == p_class) {
// Parent Node dynmisch suchen
l_node = p_node;
if (l_node.nodeName == p_parentName) {
return l_node;
while(l_node != null && l_node.parentNode != null) {
if (l_node.parentNode.nodeName == p_parentName) {
return l_node.parentNode;
else {
l_node = l_node.parentNode;
// 2) wenn nicht 1) oder nicht in 1) gefunden, dann in den Kindelementen
// weitersuchen
if (p_node.children.length > 0) {
var i = 0;
while (i<p_node.children.length && l_element==null) {
l_element = vd_search( p_node.children[i], p_searchIn, p_class, p_parentName);
i++;
return l_element;
} // -- eof vd_search() -- //
// Gibt an, ob Debug ein- (true) oder ausgeschaltet (false) ist.
// Return
// true - debug ist eingeschaltet
// false - debug ist ausgeschaltet
function vd_debug()
return g_DEBUG;
-->
</script>
Maybe you have to modify the "vd_getBody" function. I'm searching the table cell with having the class "t10data". When you use another theme, there's maybe another class used.
Second is, that you set an static id for your report region. I prefer this structure:
R<app-id><page-id><seq> (Raaaaappppsss) e.g. R094260001010.
First example is to turn off the onMouse-Effect. Maybe on the first or last column definition you put this code in the "HTML-Expression" area:
<script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#ID#This will call the example function ex_conditional_tr with the parameter
a) the region id
b) the rownum (as oracle always starts with 1 this is the first data row [rownum=0 is the table header row])
Second example is the conditional formatting of a table cell. Put this in the HML-Expression area:
<script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#ENAME#This will call the example function ex_conditional_tr with the parameter
a) the region id
b) the rownum
c) the cellnum (here we have to subtract 1 to get the "real" cell index)
The "ex_conditional" functions are just a representation of how to get the row or cell node.
Hope this help a bit.
TomI would use a CASE statement in the select....
each CASE would be an img src tag for a different button if the button is an image.
does that make sense? I can include an example if you would like... -
Web flash galleries display photos in LR4.2 but html galleries don't
Web flash galleries display photos in LR4.2 but html galleries don't.
I get a black screen with "Loading" instead. And the loading never ends.
Help? Thank youSome galleries are displayed via JavaScript, so if they aren't working the make sure that you aren't blocking JavaScript.
Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
*Do not click the Reset button on the Safe mode start window or otherwise make changes.
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
Check the "Tools > Page Info > Media" tab for blocked images (scroll through all the images with the cursor Down key).<br />
If an image in the list is grayed and there is a check-mark in the box "<i>Block Images from...</i>" then remove that mark to unblock the images from that domain.
See also:
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
*http://kb.mozillazine.org/Images_or_animations_do_not_load -
Display results as String: dosen't work based on the example
Hello,
To understand how to display results as string, I tried to reproduce this:
[http://apex.oracle.com/pls/otn/f?p=31517:84|http://apex.oracle.com/pls/otn/f?p=31517:84]
I have my table emp
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7839 KING PRESIDENT - 81-11-17 5000 - 10
7698 BLAKE MANAGER 7839 81-05-01 2850 - 30
7782 CLARK MANAGER 7839 81-06-09 2450 - 10
7566 JONES MANAGER 7839 81-04-02 2975 - 20
7788 SCOTT ANALYST 7566 82-12-09 3000 - 20
7902 FORD ANALYST 7566 81-12-03 3000 - 20
7369 SMITH CLERK 7902 80-12-17 800 - 20
7499 ALLEN SALESMAN 7698 81-02-20 1600 300 30
7521 WARD SALESMAN 7698 81-02-22 1250 500 30
7654 MARTIN SALESMAN 7698 81-09-28 1250 1400 30
7844 TURNER SALESMAN 7698 81-09-08 1500 0 30
7876 ADAMS CLERK 7788 83-01-12 1100 - 20
7900 JAMES CLERK 7698 81-12-03 950 - 30
7934 MILLER CLERK 7782 82-01-23 1300 - 10 I created with the wizard, on my page, a new REPORT REGION
- selected SQL RESULT -
- Name: Test
- Region Source Type: SQL Query
- Region Template: Report Region
IN Enter SQL Query or PL/SQL function returning a SQL Query, I COPY-PASTE the following code from [http://apex.oracle.com/pls/otn/f?p=31517:84|http://apex.oracle.com/pls/otn/f?p=31517:84]
DECLARE
p_vc_arr2 htmldb_application_global.vc_arr2;
p_string VARCHAR2 (2000);
BEGIN
SELECT ename
BULK COLLECT INTO p_vc_arr2
FROM emp
WHERE deptno = :p84_select_deptno;
p_string :=
HTMLDB_UTIL.table_to_string (p_vc_arr2, ':');
HTP.p (p_string);
END;AND I have this error:
+1 error has occurred+
Invalid query, no select statement found
Is not a PL/SQP functiion??
What do I do wrong?
thanks,
Roseline Paquin
Montreal, Canada1 error has occurred
Invalid query, no select statement foundWhat if you try
DECLARE
p_vc_arr2 htmldb_application_global.vc_arr2;
p_string VARCHAR2 (2000);
BEGIN
SELECT ename
BULK COLLECT INTO p_vc_arr2
FROM emp
WHERE deptno = :p84_select_deptno;
return 'select ''' || HTMLDB_UTIL.table_to_string (p_vc_arr2, ':') || ''' str from dual';
END;?? -
After displaying result of report, my report goes back to source code edito
Hello experts,
I am currently having a big problem with my report. Here is the problem, after displaying the
result(write), when I press BACK button it is not going back to my selection-screen which is the
usual for reports. Now, what happens is that it goes back to the source code or worse, to the main menu of SAP.
What I want to do is that when I press BACK button it should go to either selection-screen 500 or
selection-screen 1500.
Here's a rough flow of what is happening in my report:
start report -> fetch records based on user input -> display results(not in ALV) ->
after displaying report, click 'BACK' button -> it goes back to source code
Now, here's what I want to do:
start report -> fetch records based on user input -> display results(not in ALV) ->
after displaying report, click 'BACK' button -> go back to either selection-screen 500 or 1500
or call again the transaction of my report.
Help would be greatly appreciated here.Hi guys,
Thanks again for the quick replies.Here is the source code:
REPORT zdealer_contacts NO STANDARD PAGE HEADING
LINE-COUNT 0
LINE-SIZE 255
MESSAGE-ID zz.
TYPE-POOLS: slis.
Data Dictionary Tables
TABLES: zts0001,
zsoemailid,
kna1,
zts_stpgeoloc.
Includes
*INCLUDE zun_globe_header. " Globe Telecom Report Header
Structures, internal tables and data declarations
TYPES: BEGIN OF t_upload,
kunnr LIKE zts0001-kunnr,
zaddress(100),
zcperson(30),
zcnumber(18),
END OF t_upload.
TYPES: BEGIN OF t_error,
kunnr LIKE zts0001-kunnr,
zaddress(100),
zcperson(30),
zcnumber(18),
END OF t_error.
TYPES: BEGIN OF t_kna1,
name1 LIKE kna1-name1,
END OF t_kna1.
TYPES: BEGIN OF t_zts0001,
kunnr LIKE zts0001-kunnr,
cdseq LIKE zts0001-cdseq,
zaddress LIKE zts0001-zaddress,
zcperson LIKE zts0001-zcperson,
zcnumber LIKE zts0001-zcnumber,
zactivated LIKE zts0001-zactivated,
name1 LIKE kna1-name1,
END OF t_zts0001.
DATA: it_upload TYPE STANDARD TABLE OF t_upload WITH HEADER LINE,
it_error TYPE STANDARD TABLE OF t_error WITH HEADER LINE,
it_kna1 TYPE STANDARD TABLE OF t_kna1 WITH HEADER LINE,
it_zts0001 TYPE STANDARD TABLE OF t_zts0001 WITH HEADER LINE.
DATA: it_ztstemp LIKE zts0001 OCCURS 100 WITH HEADER LINE,
it_ztstemp_gloc LIKE zts_stpgeoloc OCCURS 100 WITH HEADER LINE.
*AVH - start of insertion - 04/18/06
FIELD-SYMBOLS: <fs_zts0001> LIKE LINE OF it_zts0001.
**ALV Declarations
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
g_repid LIKE sy-repid,
gs_layout TYPE slis_layout_alv,
gt_list_top_of_page TYPE slis_t_listheader,
gt_events TYPE slis_t_event WITH HEADER LINE,
gt_print TYPE slis_print_alv.
CONSTANTS: gc_top TYPE slis_formname VALUE 'TOP_OF_PAGE',
gc_topsum TYPE slis_formname VALUE 'TOP_OF_LIST',
gc_ucomm TYPE slis_formname VALUE 'USER_COMMAND'.
*AVH - end of insertion
Variables
DATA: v_kunnr LIKE zts0001-kunnr,
v_title(100) TYPE c,
gc_kunnr(06) TYPE c,
v_compflag(1) TYPE c,
v_flag(1).
Selection Screen
*AVH - start of modification - 06/27/06
*if user is controller, selection-screen 500 will be called else,
*selection-scren 1500 will be called.
*selection-screen for controllers
SELECTION-SCREEN BEGIN OF SCREEN 500.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pr_upld RADIOBUTTON GROUP grp2 USER-COMMAND ucomm1.
SELECTION-SCREEN COMMENT 2(20) text-007 FOR FIELD pr_upld.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 03(15) text-a11 FOR FIELD p_flnme.
PARAMETERS: p_flnme LIKE rlgrap-filename DEFAULT 'C:\'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pr_list1 RADIOBUTTON GROUP grp2.
SELECTION-SCREEN COMMENT 2(7) text-003 FOR FIELD pr_list1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 500.
*selection-screen for non-controllers.
SELECTION-SCREEN BEGIN OF SCREEN 1500.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(22) text-002 FOR FIELD p_dcode.
PARAMETERS: p_dcode LIKE vbak-kunnr,
p_name1 LIKE kna1-name1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pr_list2 RADIOBUTTON GROUP grp USER-COMMAND ucomm2.
SELECTION-SCREEN COMMENT 2(7) text-003 FOR FIELD pr_list2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pr_add RADIOBUTTON GROUP grp.
SELECTION-SCREEN COMMENT 2(3) text-005 FOR FIELD pr_add.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pr_edit RADIOBUTTON GROUP grp.
SELECTION-SCREEN COMMENT 2(4) text-006 FOR FIELD pr_edit.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 03(20) text-a12 FOR FIELD p_code.
PARAMETERS: p_code LIKE zts0001-cdseq.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 1500.
INITIALIZATION.
SELECT SINGLE kunnr comp_flag INTO (gc_kunnr,v_compflag)
FROM zsoemailid
WHERE bname = sy-uname.
IF sy-subrc <> 0.
MESSAGE i000 WITH
'You are not authorised to use this transaction'.
LEAVE PROGRAM.
ENDIF.
IF v_compflag = 'X'.
CALL SCREEN 500.
ELSE.
CALL SCREEN 1500.
ENDIF.
*AVH - end of modification
AT SELECTION-SCREEN OUTPUT.
PERFORM authority_check.
added by derick 050125
**-changed by weng rulloda 06012005
*AVH - start of insertion - 05/22/06
*no need to get value of kunnr from global memory
*since gc_kunnr would be filled via the select statement below
GET PARAMETER ID 'KUN' FIELD gc_kunnr.
*AVH - end of insertion
p_dcode = gc_kunnr.
*AVH - start of insertion - 05/22/06
**fetch the respective description of dealer based from p_dcode
**and put in parameter p_name1
SELECT SINGLE name1 FROM kna1
INTO p_name1
WHERE kunnr = p_dcode.
*AVH - end of insertion
*AVH - start of insertion - 05/22/06
**selection-screen parameters is based if user is controller or not.
**created new selection-screen conditions based from orig. code
v_kunnr = gc_kunnr.
LOOP AT SCREEN.
IF screen-name = 'P_DCODE'.
screen-input = '0'.
screen-output = '1'.
MODIFY SCREEN.
ELSEIF screen-name = 'P_NAME1'.
screen-input = '0'.
screen-output = '1'.
MODIFY SCREEN.
ELSEIF screen-name = 'P_CODE'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
IF pr_list2 = 'X' OR pr_add = 'X'.
LOOP AT SCREEN.
IF screen-name = 'P_CODE'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF pr_edit = 'X'.
LOOP AT SCREEN.
IF screen-name = 'P_CODE'.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF pr_list1 = 'X'.
LOOP AT SCREEN.
IF screen-name = 'P_FLNME'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
*AVH - end of modification
AT SELECTION-SCREEN.
CHECK sy-ucomm = 'UCOMM1' OR sy-ucomm = 'UCOMM2'.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnme.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnme.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',.,..'
mode = 'O'
title = 'File Selection'
IMPORTING
filename = p_flnme
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_code.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_code.
DATA : BEGIN OF itab_list OCCURS 0,
kunnr LIKE zts0001-kunnr,
cdseq LIKE zts0001-cdseq,
zaddress LIKE zts0001-zaddress,
zcperson LIKE zts0001-zcperson,
zcnumber LIKE zts0001-zcnumber,
END OF itab_list.
DATA: tab_fields LIKE dfies OCCURS 0 WITH HEADER LINE,
tab_valuetab(100) TYPE c OCCURS 0 WITH HEADER LINE.
DATA: tab_dynnr TYPE sy-dynnr.
DATA: BEGIN OF tab_return_tab OCCURS 0.
INCLUDE STRUCTURE ddshretval.
DATA: END OF tab_return_tab.
DATA: progname LIKE sy-repid.
CLEAR: tab_valuetab[], tab_fields[].
SELECT kunnr cdseq zaddress zcperson zcnumber
INTO CORRESPONDING FIELDS OF TABLE itab_list
FROM zts0001
WHERE kunnr = v_kunnr.
tab_dynnr = sy-dynnr.
tab_fields-tabname = 'ZTS0001'.
tab_fields-fieldname = 'KUNNR'.
APPEND tab_fields.
tab_dynnr = sy-dynnr.
tab_fields-tabname = 'ZTS0001'.
tab_fields-fieldname = 'CDSEQ'.
APPEND tab_fields.
tab_fields-tabname = 'ZTS0001'.
tab_fields-fieldname = 'ZADDRESS'.
APPEND tab_fields.
tab_fields-tabname = 'ZTS0001'.
tab_fields-fieldname = 'ZCPERSON'.
APPEND tab_fields.
tab_fields-tabname = 'ZTS0001'.
tab_fields-fieldname = 'ZCNUMBER'.
APPEND tab_fields.
LOOP AT itab_list.
tab_valuetab = itab_list-kunnr.
APPEND tab_valuetab.
tab_valuetab = itab_list-cdseq.
APPEND tab_valuetab.
tab_valuetab = itab_list-zaddress.
APPEND tab_valuetab.
tab_valuetab = itab_list-zcperson.
APPEND tab_valuetab.
tab_valuetab = itab_list-zcnumber.
APPEND tab_valuetab.
ENDLOOP.
progname = sy-repid.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CDSEQ'
dynpprog = progname
dynpnr = '1000'
dynprofield = 'P_CODE'
TABLES
value_tab = tab_valuetab
field_tab = tab_fields
return_tab = tab_return_tab
EXCEPTIONS
OTHERS = 0.
START-OF-SELECTION.
IF pr_edit = 'X' AND p_code IS INITIAL.
MESSAGE i008 WITH 'Please specify a ship-to code.'.
LEAVE TO TRANSACTION 'ZDCONTACT'.
ENDIF.
PERFORM get_data.
IF pr_upld = 'X'.
PERFORM upload_file.
ELSEIF pr_add = 'X'.
PERFORM add_record.
ELSEIF pr_edit = 'X'.
PERFORM edit_record.
ELSEIF pr_list1 = 'X' OR pr_list2 = 'X'.
PERFORM display_alv.
ENDIF.
END-OF-SELECTION.
based from ALV PF-STATUS
IF sy-ucomm = '&F03'. "BACK
LEAVE TO TRANSACTION 'ZDCONTACT'.
ELSEIF sy-ucomm = '&F15'. "EXIT
LEAVE TO TRANSACTION 'ZDCONTACT'.
ELSEIF sy-ucomm = '&F12'. "CANCEL
LEAVE TO TRANSACTION 'ZDCONTACT'.
ENDIF.
*& Form authority_check
FORM authority_check.
CALL FUNCTION 'AUTHORITY_CHECK'
EXPORTING
field1 = 'TCD' "MDM
object = 'S_TCODE'
user = sy-uname
value1 = 'ZMEN'
VALUE3 = '01' MDM
EXCEPTIONS
user_dont_exist = 1
user_is_authorized = 2
user_not_authorized = 3
user_is_locked = 4
OTHERS = 5.
IF sy-subrc NE 2.
**-added by weng 04/28/2006
**-if user is not authorized to use dealer portal check if he is
**- authorized to use the tcode ZDCONTACT
CALL FUNCTION 'AUTHORITY_CHECK'
EXPORTING
field1 = 'TCD' "MDM
object = 'S_TCODE'
user = sy-uname
value1 = 'ZDCONTACT'
VALUE3 = '01' MDM
EXCEPTIONS
user_dont_exist = 1
user_is_authorized = 2
user_not_authorized = 3
user_is_locked = 4
OTHERS = 5.
**-weng
IF sy-subrc NE 2.
MESSAGE i000 WITH
'You are not authorised to use this transaction'.
LEAVE PROGRAM.
ENDIF.
ENDIF.
ENDFORM. " AUTHORITY_CHECK
*& Form get_data
FORM get_data.
*AVH - start of insertion - 04/19/06
**records selected from table zts0001 that has been marked as
**activated will be fetched otherwise, ignore.
IF v_kunnr IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE it_zts0001
FROM zts0001.
ELSEIF v_compflag = 'X'.
SELECT * INTO CORRESPONDING FIELDS OF TABLE it_zts0001
FROM zts0001.
ELSE.
SELECT * INTO CORRESPONDING FIELDS OF TABLE it_zts0001
FROM zts0001
WHERE kunnr = v_kunnr.
ENDIF.
*AVH - start of insertion - 05/24/06
**fetch name based from kunnr and put in itab
LOOP AT it_zts0001 ASSIGNING <fs_zts0001>.
SELECT SINGLE name1 FROM kna1
INTO <fs_zts0001>-name1
WHERE kunnr = <fs_zts0001>-kunnr.
ENDLOOP.
*AVH - end of insertion
ENDFORM. " get_data
*& Form Upload_file
FORM upload_file.
DATA: lv_seq(5) TYPE n,
lv_ctr(5) TYPE c,
lv_kunnr LIKE it_upload-kunnr.
v_title = 'Upload from File'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_flnme
filetype = 'DAT'
TABLES
data_tab = it_upload
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE i008 WITH 'File does not exist.'.
IF v_compflag IS INITIAL.
LEAVE TO TRANSACTION 'ZDCONTACT'.
ELSE.
LEAVE TO TRANSACTION 'ZDCONTACT'.
ENDIF.
ENDIF.
CHECK sy-subrc EQ 0.
DELETE it_upload
WHERE zaddress EQ space
AND zcperson EQ space
AND zcnumber EQ space.
SORT it_zts0001 BY kunnr ASCENDING cdseq DESCENDING.
SORT it_upload BY kunnr ASCENDING.
LOOP AT it_upload.
lv_kunnr = it_upload-kunnr.
AT NEW kunnr.
AVH - start of insertion - 06/30/06
SELECT SINGLE kunnr FROM zsoemailid
INTO lv_kunnr
WHERE kunnr = it_upload-kunnr.
if it_upload-kunnr is not found in table ZSOEMAILID, it will
not be included in the upload.
IF sy-subrc <> 0.
DELETE it_upload.
CLEAR it_upload.
CONTINUE.
ENDIF.
AVH - end of insertion
READ TABLE it_zts0001 WITH KEY kunnr = lv_kunnr.
IF sy-subrc EQ 0.
lv_seq = it_zts0001-cdseq.
ELSE.
CLEAR lv_seq.
ENDIF.
ENDAT.
IF it_upload-zaddress IS INITIAL.
MOVE-CORRESPONDING it_upload TO it_error.
APPEND it_error.
CLEAR it_error.
ELSE.
REPLACE '"' WITH '' INTO it_upload-zaddress.
REPLACE '"' WITH '' INTO it_upload-zaddress.
REPLACE '"' WITH '' INTO it_upload-zcperson.
REPLACE '"' WITH '' INTO it_upload-zcperson.
CONDENSE it_upload-zaddress.
CONDENSE it_upload-zcperson
ADD 1 TO lv_seq.
MOVE: it_upload-kunnr TO it_ztstemp-kunnr,
lv_seq TO it_ztstemp-cdseq,
it_upload-zaddress TO it_ztstemp-zaddress,
it_upload-zcperson TO it_ztstemp-zcperson,
it_upload-zcnumber TO it_ztstemp-zcnumber,
'X' TO it_ztstemp-zactivated,
sy-uname TO it_ztstemp-zcreated_by,
sy-datum TO it_ztstemp-zchanged_date.
MOVE-CORRESPONDING it_ztstemp TO it_ztstemp_gloc.
APPEND: it_ztstemp, it_ztstemp_gloc.
CLEAR: it_ztstemp, it_ztstemp_gloc.
ENDIF.
ENDLOOP.
IF NOT it_ztstemp[] IS INITIAL.
INSERT zts0001 FROM TABLE it_ztstemp.
INSERT zts_stpgeoloc FROM TABLE it_ztstemp_gloc.
WRITE:/ 'List of Records Uploaded.' COLOR 1 INTENSIFIED ON.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/(020) 'Dealer Code' CENTERED,
(007) 'Code' CENTERED,
(100) 'Address',
(030) 'Contact Person' CENTERED,
(018) 'Contact Number' CENTERED.
FORMAT COLOR OFF.
WRITE:/(179) sy-uline.
DESCRIBE TABLE it_ztstemp LINES lv_ctr.
SORT it_ztstemp BY kunnr cdseq.
LOOP AT it_ztstemp.
WRITE:/(020) it_ztstemp-kunnr,
(007) it_ztstemp-cdseq,
(100) it_ztstemp-zaddress,
(030) it_ztstemp-zcperson,
(018) it_ztstemp-zcnumber.
ENDLOOP.
SKIP 1.
WRITE:/ 'TOTAL :', lv_ctr.
ENDIF.
IF NOT it_error[] IS INITIAL.
SKIP 2.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/(020) 'Dealer Code' CENTERED,
(030) 'Contact Person' CENTERED,
(018) 'Contact Number' CENTERED.
FORMAT COLOR OFF.
WRITE:/(070) sy-uline.
DESCRIBE TABLE it_error LINES lv_ctr.
SORT it_error BY kunnr zcperson.
LOOP AT it_error.
WRITE:/ 'With No Address.' COLOR 6 INTENSIFIED ON.
WRITE:/(020) it_error-kunnr,
(030) it_error-zcperson,
(018) it_error-zcnumber.
ENDLOOP.
SKIP 1.
WRITE:/ 'TOTAL :', lv_ctr.
ENDIF.
ENDFORM. " Upload_file
*& Form add_record
FORM add_record.
v_title = ''.
IF NOT v_kunnr IS INITIAL.
SUBMIT zdealer_contacts_add_edit AND RETURN
WITH p_kunnr = v_kunnr
WITH p_name1 = p_name1 "AVH
WITH p_cdseq = space
WITH p_flag = 'A'
WITH p_addr = it_zts0001-zaddress
WITH p_pers = it_zts0001-zcperson
WITH p_numb = it_zts0001-zcnumber
VIA SELECTION-SCREEN.
ENDIF.
LEAVE TO TRANSACTION 'ZDCONTACT'.
ENDFORM. " add_record
*& Form edit_record
FORM edit_record.
v_title = ''.
READ TABLE it_zts0001 WITH KEY kunnr = v_kunnr
cdseq = p_code.
IF sy-subrc EQ 0.
SUBMIT zdealer_contacts_add_edit AND RETURN
WITH p_kunnr = v_kunnr
WITH p_name1 = p_name1 "AVH
WITH p_cdseq = p_code
WITH p_flag = 'E'
WITH p_addr = it_zts0001-zaddress
WITH p_pers = it_zts0001-zcperson
WITH p_numb = it_zts0001-zcnumber
WITH v_controller = v_compflag
VIA SELECTION-SCREEN.
ELSE.
MESSAGE i008 WITH 'No record found.'.
CALL TRANSACTION 'ZDCONTACT'.
ENDIF.
LEAVE TO TRANSACTION 'ZDCONTACT'.
ENDFORM. " edit_record
*& Form display_records
*FORM display_records.
IF NOT it_zts0001[] IS INITIAL.
v_title = 'List of Dealer Contacts'.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/(020) 'Customer Number' CENTERED,
(007) 'Code' CENTERED,
(100) 'Address',
(030) 'Contact Person' CENTERED,
(018) 'Contact Number' CENTERED.
FORMAT COLOR OFF.
WRITE:/(179) sy-uline.
SORT it_zts0001 BY kunnr cdseq.
LOOP AT it_zts0001.
WRITE:/(020) it_zts0001-kunnr,
(007) it_zts0001-cdseq,
(100) it_zts0001-zaddress,
(030) it_zts0001-zcperson,
(018) it_zts0001-zcnumber.
ENDLOOP.
ELSE.
MESSAGE i008 WITH 'No records to display.'.
ENDIF.
*ENDFORM. " display_records
*& Form display_alv
FORM display_alv.
SORT it_zts0001 BY kunnr cdseq.
PERFORM f_build_layout USING gs_layout.
PERFORM f_init_fieldcat USING gt_fieldcat[].
PERFORM f_init_events USING 'BACK' gt_events[].
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
i_save = 'X'
it_sort = gt_sort
TABLES
t_outtab = it_zts0001[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DISPLAY_ALV
FORM top_of_page *
FORM top_of_page.
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
lv_title(60),
lv_user(60),
lv_date(10),
lv_time(10),
lv_time_n_date(30),
lv_dcode_n_name(150),
lv_dlr_n_desc(100),
ld_lines TYPE i,
ld_linesc(10) TYPE c.
Title
CLEAR: lv_title, wa_header.
MOVE sy-title TO lv_title.
wa_header-typ = 'H'.
wa_header-info = lv_title.
APPEND wa_header TO t_header.
CLEAR wa_header.
User
CLEAR: lv_user, wa_header.
CONCATENATE: 'Generated by:' sy-uname
INTO lv_user SEPARATED BY space.
wa_header-typ = 'A'.
wa_header-info = lv_user.
APPEND wa_header TO t_header.
CLEAR wa_header.
*Date and time
CLEAR: lv_date, lv_time.
WRITE: sy-datum TO lv_date MM/DD/YYYY,
sy-uzeit TO lv_time USING EDIT MASK '__:__:__'.
CONCATENATE: 'Generated on:' lv_date lv_time
INTO lv_time_n_date SEPARATED BY space.
wa_header-typ = 'A'.
wa_header-info = lv_time_n_date.
APPEND wa_header TO t_header.
CLEAR wa_header.
IF NOT v_kunnr IS INITIAL AND v_compflag IS INITIAL.
*Dealer code and name
CONCATENATE: 'Dealer:' p_dcode p_name1
INTO lv_dcode_n_name SEPARATED BY space.
wa_header-typ = 'A'.
wa_header-info = lv_dcode_n_name.
APPEND wa_header TO t_header.
CLEAR wa_header.
ENDIF.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. " TOP_OF_PAGE
FORM f_build_layout *
--> %LAYOUT *
FORM f_build_layout USING %layout TYPE slis_layout_alv.
%layout-zebra = 'X'.
%layout-colwidth_optimize = 'X'.
ENDFORM. " F_BUILD_LAYOUT
FORM f_init_fieldcat *
--> %FIELDCAT *
FORM f_init_fieldcat USING %fieldcat TYPE slis_t_fieldcat_alv.
DATA: lc_fieldcat TYPE slis_fieldcat_alv.
CLEAR lc_fieldcat.
DEFINE m_field.
add 1 to lc_fieldcat-col_pos.
lc_fieldcat-fieldname = &1.
lc_fieldcat-outputlen = &2.
lc_fieldcat-seltext_l = &3.
lc_fieldcat-do_sum = &4.
lc_fieldcat-inttype = &5.
lc_fieldcat-hotspot = &6.
lc_fieldcat-fix_column = &7.
lc_fieldcat-ddictxt = 'L'.
lc_fieldcat-no_zero = 'X'.
append lc_fieldcat to %fieldcat.
END-OF-DEFINITION.
IF v_kunnr IS INITIAL.
m_field 'KUNNR' '5' 'Dealer Code' '' '' '' ''.
ENDIF.
IF v_compflag = 'X'.
m_field 'KUNNR' '5' 'Dealer Code' '' '' '' ''.
ENDIF.
IF v_compflag = 'X'.
m_field 'NAME1' '40' 'Dealer Name' '' '' '' ''.
ENDIF.
m_field 'CDSEQ' '05' 'Ship-To Code' '' '' '' ''.
m_field 'ZADDRESS' '100' 'Address' '' '' '' ''.
m_field 'ZCPERSON' '30' 'Contact Person' '' '' '' ''.
m_field 'ZCNUMBER' '18' 'Contact Number' '' '' '' ''.
IF v_kunnr IS INITIAL.
m_field 'NAME1' '40' 'Dealer Name' '' '' '' ''.
ENDIF.
m_field 'ZACTIVATED' '1' 'Activated' '' '' '' ''.
ENDFORM. " f_init_fieldcat
FORM f_init_events *
--> P_TYPE *
--> %EVENTS *
FORM f_init_events USING p_type CHANGING %events TYPE slis_t_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = %events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc = 0.
PERFORM f_build_events USING: slis_ev_user_command.
IF p_type = 'TOP'.
PERFORM f_build_events USING: gc_top.
ELSEIF p_type = 'SUM'.
PERFORM f_build_events_sum USING: gc_topsum.
ENDIF.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " F_INIT_EVENTS
FORM user_command *
--> P_UCOMM *
--> P_SELFIELD *
FORM user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN 'E'.
CALL SELECTION-SCREEN 500.
ENDCASE.
ENDFORM.
FORM f_build_events *
--> %EVENT *
FORM f_build_events USING %event.
READ TABLE gt_events WITH KEY name = %event.
IF sy-subrc = 0.
MOVE: %event TO gt_events-form.
MOVE 'USER_COMMAND' TO gt_events-form.
MODIFY gt_events INDEX sy-tabix.
ENDIF.
ENDFORM. " F_BUILD_EVENTS -
Execute Package and Display Results
Hi Everyone,
Just starting to use packages. I've successfully compiled the package below.
Can someone please show me how to execute it and display the results with SQL Developer?
Thank You in Advance for Your Help,
Lou
create or replace
PACKAGE pkg_Search
AS
TYPE CUSTOM_REF_CURSOR IS REF CURSOR;
PROCEDURE My_Procedure (
arg_Cursor IN OUT CUSTOM_REF_CURSOR);
END;
create or replace
PACKAGE BODY pkg_Search
AS
PROCEDURE My_Procedure (
arg_Cursor IN OUT CUSTOM_REF_CURSOR)
IS
BEGIN
OPEN arg_Cursor FOR
SELECT sysdate FROM DUAL;
END;
END;SQL Developer can't display the result of this particular package. I assume that what you want to see is the result set from the REF CURSOR that you have as an OUT parameter. However, you can do this with SQL*Plus - here is a script:
VARIABLE my_cursor REFCURSOR;
BEGIN
pkg_search.my_procedure(:my_cursor);
END;
PRINT my_cursor;
exit -
Php check all records in database then display results based on chosen record
I have a form that is checking the database to see if a record exists .
If it does exist then it needs to perform one of two tasks, either subtract or multiple.
This part is working but the part that is not working is it is only checking the first record of the database and it should be checking all records as each record will give a different result
the sql is
mysql_select_db($database_lotties, $lotties);
$query_rsVoucher = "SELECT * FROM LOTTIE_vouchercode";
$rsVoucher = mysql_query($query_rsVoucher, $lotties) or die(mysql_error());
$row_rsVoucher = mysql_fetch_assoc($rsVoucher);
$totalRows_rsVoucher = mysql_num_rows($rsVoucher);
// then check
if (isset($_POST['vouchCode']) && $_POST['vouchCode'] == $row_rsVoucher['VCode']) {
$mycode = $row_rsVoucher['VCode'];
$spos = strpos($mycode, "f");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
$myvalue = $XCart_sumTotal * $myvalue / 100;
} else {
$spos = strpos($mycode, "p");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
$myTotal = $XCart_sumTotal - $myvalue;
$_SESSION['vouchCode'] = $myvalue;
} else unset($_SESSION['vouchCode']);
the form is
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
<input type="text" name="vouchCode" value="<?php echo @$_POST['vouchCode']; ?>" size="32" />
<input type="submit" value="update" />
</form>
then the results are displayed
<?php if (isset($myvalue)) { ?>
<?php echo DoFormatCurrency($myvalue, 2, ',', '.', '£ ', ''); ?>
<?php } ?>
i am getting really desperate with this so any help would be appreciated
thanksJonathan Fortis wrote:
>>You really should hire someone to write your server side code as you still don't understand programming basics.
i did but he passed away. And i am getting an understanding just still cant get the hang of loops
jonathan, jonathan, jonathan,
Condolences to your deceased php developer. Was he the only professional php developer in the world? I don't think so! Enough with your excuses already. Find a professional php developer that is currecntly living then and stop looking for free professional work for your specific, profitable development requirements on a forum.
best,
Shocker -
How to get Test Results to SQL w/o Coldfusion
Is there a way to get Captivate test results (or any results)
to SQL. I was thinking of using the SCORM interface?
A simple elegant solution would be great since I want to
build it into to all my componants.
Thanks in advance,
ScottIf your organization is running Sharpoint 3.x, you can use
the sharepoint learning kit which runs off of a sql back end. This
is a SCORM 2004 compliant LMS that can be found here:
http://www.codeplex.com/SLK
If you want to do this without an LMS, you can set up your
quiz to just send the score as in this article:
http://www.adobe.com/devnet/captivate/articles/store_cpresults_print.html
You steal the idea from here, but in your javascript, you can
do a pass your variables (quiz resutls), to an asp.net page that
places them into a SQL db. I'm working on such a solution right
now. That way, you don't need an LMS and you have complete control
over how and when the results are stored. -
How to display records into a non table base block..
Hi,
Can anybody help me how to display records into a non table base block....
Find below is my coding but it only display the last record in the first line
in the block.
PROCEDURE CREATE_CARTON_QUESTION IS
CURSOR car_c IS
select /*+ rule */ question_id, question_description
from WHOP.QADB_QUESTIONS
where question_category = 'Carton'
and question_active_flag = 'Y';
v_found VARCHAR2(10);
v_status boolean;
v_error varchar2(150);
v_count number;
car_r car_c%rowtype;
begin
begin
select count(*) into v_count
from WHOP.QADB_QUESTIONS
where question_category = 'Carton'
and question_active_flag = 'Y';
exception
when no_data_found then
v_count := 0;
end;
if v_count > 0 then
for car_r in car_c loop
---populating carton questions
:la_carton.carton_question_id := car_r.question_id;
:la_carton.carton_question_answer := 'N';
:la_carton.carton_error_details := null;
:la_carton.attribute2 := car_r.question_description;
end loop;
end if;
end;
Thanks in advance.
Regards,
JunHi SNatapov,
Thanks for you reply but still I get this error...
FRM-40737 Illegal restricted procedure GO_BLOCK in WHEN-VALIDATE-ITEM trigger.
Please note that I call that program unit in the last field of my control block inside when-validate-item trigger the questions should be display in la_carton block which is my non-base table block.
Find below is the code....
begin
go_block('la_carton');
first_record;
for car_r in car_c loop
---populating carton questions
:la_carton.carton_question_id := car_r.question_id;
:la_carton.carton_question_answer := 'N';
:la_carton.carton_error_details := null;
:la_carton.attribute2 := car_r.question_description;
next_record;
end loop;
end;
Hoping you can help me this problem...
Thanks in advance.
Regards,
Jun -
Hi All,
I am crawling documents from a file server. I created a new content source and crawled the documents. All documents are crawled successfully.
Then I went to my enterprise search center site collection and created a new result source. I have added the query to use above content source.
After that, on a page I am trying to configure the search results web part to display documents using this result source. Now the problem is:
It displays all the documents that are crawled without searching for anything. I mean first it should not display any results. If a user searches for something , then according to that search it should display results.
Any idea how to do this in the web part? I am using SharePoint 2013 on premise enterprise edition. No code. Totally OOTB.Hi Mohan,
What did you use for the Query text in the result source?
I could reproduce this issue when I used Query text like: {searchTerms} Path:”http://sps2k13sp/sites/First/Shared%20Documents”
Then I changed the Query to
{?{searchTerms}
Path:"http://sps2k13sp/sites/First/Shared%20Documents"}
, then Search result web part didn’t return results without searching.
So , check your result source, and use the Query like the above(adding "{?...}").
I hope this helps.
Thanks,
Wendy
Wendy Li
TechNet Community Support -
Display results of MySQL query from AMFPHP by ArrayCollection in AS3 (Flash CS4)
Hi, i am using Flash CS4 (AS3) + AMFPHP + MySQL to do own flash frontend for Wordpress CMS. Everything is going fine but i`ve got one problem. Problem with properly display of result of query in AS3 by using ArrayCollection.
When i check my service in "amfphp/browser/" in web browser i`ve got this (with all needed data):
(mx.collections::ArrayCollection)#0
filterFunction = (null)
length = 2
list = (mx.collections::ArrayList)#1
length = 2 source = (Array)#2
That is the reason that i suppose that service work fine. Problem is when i try to display result in AS3. In actionscript i have got this:
function getNewsListHandler(result:Object):void{
trace(result);
This function displays: [object Object].
I know that "result" is an ArrayCollection type but i don`t know how to get rows and columns from this. I know that my data is there but i have no idea how to get it.
Clarify: I don`t know how to get to Arrays and simple data variables which are in ArrayCollection.
Could anyone help me with that problem. I would be gratefull
P.S. I tried also change query type in service.PHP for mysql_fetch_query but in that case i`ve got only one row (not all data).Thanks for fast reply,
arr_coll:ArrayCollection = new ArrayCollection ({col1:"data1",col2:"data2"}, {col1:"data3",col2:"data4"});
you would get the data like
var resultstr:String = arr_coll[1][1].col2;
trace(resultstr);
//results in data4
could you explain me how it was happen (arr_coll[1][1].col2)? It`s not clear to me. I thought in this case rather something like this :
var resultstr:String = arr_coll[1]['col2'];
It should give me "data4". I know it wasn`t but i don`t understand ArrayCollection in level which is needed to use your advice in my case. Could you clarify "arr_coll[1][1].col2" a bit?
What would it look like when you would have something like this:
arr_coll:ArrayCollection = new ArrayCollection ({col1:"data1",col2:"data2"}, {col1:"data3",col2:"data4"},{col1:"data5",col2:"data6"},{col1:"data7",col2:"data8"});
and you would want know f.e. position in ArrayCollection of "data6". How would you code this? arr_coll[1][2].col2?
Maybe you are looking for
-
Auto-update of date and time on Lumia 800
I've recently had my Lumia 800 in for "repair" as the auto-update switch did not appear on the menu. The phone has come back (from carphone warehouse) with OS version 7.10.8858.136 and Firmware 1750.0823.8858.12460, both of which seem more up-to-dat
-
Catch mapping error message in BPM Exception branch
Hi dudes, Does anyone know how to catch the mapping runtime error message into a BPM exception branch? I know how to create an exception branch and how to trigger it, but I wonder whether it's possible to pass the mapping error message as shown in SX
-
Itunes 6.0.5 will not play ANY files
Hi. I just upgraded to version 6.0.5 and itunes will not play any of the files in my library. No error message or file location error is diplayed when I try to play a file. The song title is displyed in the main window, but the file does not progress
-
Hello there, How can I use DAQ Assistance from labview to generate two different signal and output them from two analog output(AO1) and AO2 of BNC-2120? I tried but the DAQ fails.
-
Saving logo for web – What's an Illy thread doing here?
This thread: http://forums.adobe.com/thread/470690?tstart=0 Is in the Illustrator forum... so, why is it here? Are the threads now starting to bridge the continuum?