Loop in Forms 6i
Hello All,
I'm writing a loop in Oracle forms to check a data in master-detail relationship. Can some one please help where I should start this code?
Abdi
set_application_property(cursor_style, 'BUSY');
FIRST_RECORD;
LOOP
-- processing
IF :System.Last_Record = 'TRUE' THEN
EXIT;
END IF;
NEXT_RECORD;
END LOOP;
set_application_property(cursor_style, 'DEFAULT');
the only problem which I has was that you must be in the block throught which you do this processing. If you call this from button set mouse and keyboard navigation to false. Or do before this loop GO_BLOCK().
Similar Messages
-
Hi all
shayan here
First of all sory for my last post in which i posted a lot of code...actuallly i want to describe my problem in details because it is really unknown to me......
Now i will desdcrible it in simple.Hope fully all of you can understand and give me a idea to overcome this problem......
My problem is that i had generated a record in tabluler form through Select statement......means i have made a coursor of select statement and via loop i added it to tabuler form element like this
Registration Enrollment
12321 312312
231312 23123
1232 123123
Now i had added another display item in which ihave to calculate another thing like this
Registration Enrollment CGPA
12321 312312 2.14
231312 23123 1.23
1232 123123
I have done it but problem is that it is showing the cgpa in front of only one item...
not on all
i dont know why??????
also i want to insert this into another table like this....if this CGPA is final then insert it into final_CGPA table else it will update table with this CGPA.....
I had written the Insert and update statement on when button pressed button but it is not updateing or inserting.....
any help regarding this is highly appreciated
Thanks in advance
Shayan
[email protected]Hello,
Forms always creates the first record in each block, but if you want to add manually some more records, you have to use the Create_Record built-in for each new record you want to create in the block.
Francois -
Loop over form values & insert into db
Form
prod_id prod_name prod_price prod_status
001 product 001 1.00 1
002 product 002 2.00 1
003 product 003 3.00 0
004 product 004 4.00 0
Form Dump
prod_name product 001,product 002,product 003,product 004
FIELDNAMES prod_id, prod_name, prod_price, prod_status
prod_price 1.00,2.00,3.00,4.00
prod_status 1,1,0,0
prod_id 001,002,003
I want to update a few fields, prod_price and prod_status. I submit these values to my update page but I'm not sure how to loop over these values and update by the prod_id. In my update page I'm using cfdump and I see the structure of the form, the fieldnames as well as the prod_id, prod_name, etc and their values.
My question is how do I loop over these form values so I'll be able to update by each prod_id? I've played around with looping over the form collection values but no luck.When I do stuff like this, I append the "id" value to the end of each form field. That enables me to ensure the other fields match up.
When processing the form, I generally do something like this:
<cfloop list="#form.fieldnames# index="ThisField">
<cfif left(ThisField, 9) is "prod_name">
<cfscript>
ThisID = removechars(thisfield, 9);
ThisName = form["prod_name" & ThisID];
same for other fields
Then do something with those variables. -
Looping Dynamic form content for SQL Insert
I have a form that is created when a user selects the number
of rows that they need ultimately deciding on how many records they
will be inserting into an SQL database. After they fill out there
information in the form and submit it I have a page that has the
SQL query. I am attempting to loop the query the same number of
rows that there are in the table. However I cannot get the query to
run because of duplicate variables. For example in a simple form
submission if I had a form text field called "Name" it would insert
into the database as '#form.name#'. If the user selected 10 rows I
would need to insert each row as '#form.name1#', '#form.name2#',
etc. If my variable for the number of rows is "i" then my entire
variable for the loop would be '#form.name#i##' which does not
work. Hope it's not too confusing and any and all help would be
appreciated.#form["contsant_part" & variable_part]#
-
Hi
Anyone know how I can use Javascript to loop through each
text box on a page
when the page loads?
Something along the lines of :
For Each document.form.input.text In document.form
Thanks
Brendan
Rate your experiences with your UK and Ireland builders at
http://www.ratethebuilder.co.uk
=========================================RateTheBuilder wrote:
> Hi
>
> Anyone know how I can use Javascript to loop through
each text box on a page
> when the page loads?
>
> Something along the lines of :
>
> For Each document.form.input.text In document.form
<script type="text/javascript">
onload=function(){
var inputs=document.getElementsByTagName("INPUT");
var inputQty=inputs.length;
while(inputQty--){
if(inputs[inputQty].type=="text"){
//do stuff with text field
inputs[inputQty].value="This is text field No.
"+(inputQty+1);
</script>
Note that this function retrieves *all* text fields, from
*all* of your
forms in the document.
Mick.
>
> Thanks
>
> Brendan
> ______________________________________________
> Rate your experiences with your UK and Ireland builders
at
>
http://www.ratethebuilder.co.uk
> =========================================
>
> -
I have a page,
http://www.boey.com/hms/vbc/vbc_edit_po.cfm?PO=333
that I need to save the data per "line_id" on the next page.
However, when I loop through the "Line_id" it puts the data from
the form fields, "W/S" like this... 45,50 so I tried looping
through both "Line_id" and "w/s" and it doesn't work. How can I can
update my table from this form? There are two different tries in my
attached code.
Thanks,
CourtneyNeither of those suggestions are working. I tried various
things with those two statements and I'm still getting an error
which is below. What is weird is that it reads this from the
previous page..
<input type="Text" name="LineID#GetInfo.CurrentRow#"
value="#GetInfo.Line_id#">
Since the code you provided is still not working maybe I have
this statement incorrect. Getting frustrated.
Error Occurred While Processing Request
Error Diagnostic Information
An error occurred while evaluating the expression:
variables.Line_ID = Form["Line_ID" & LoopCount]
Error near line 4, column 10.
The member "LINE_ID1" in dimension 1 of object "Form" cannot
be found. Please, modify the member name.
The error occurred while processing an element with a general
identifier of (CFSET), occupying document position (4:4) to (4:58).
Date/Time: 10/10/07 10:53:28
Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
Remote Address: 76.6.58.23
HTTP Referrer:
http://www.boey.com/hms/vbc/vbc_edit_po.cfm?PO=333
Query String: ID=
Please inform the site administrator that this error has
occurred (be sure to include the contents of this page in your
message to the administrator). -
How to use loop in form itself
hi,
i written like this in my form. my requirement is also below.
my issue is how for item level how ti i write the condition. means for one material supppose there are 5 to 6 line items and so there 5 to 6 differet material types.codition whatever i written same but for item level how to write the logic???
please help me..
/: IF &KNA1-SPRAS& = 'EN'
/: IF &VBDKR-FKART& EQ 'L2' AND &VBDPR-MTART& NE 'DIEN'.
TR Debit Memo
/: ELSEIF &VBDPR-MTART& EQ 'DIEN'.
/: INVOICE
/: ENDIFHi,
You can do like below, call the writ_form FM and create elements based on the condition in drvier program then call the elements in the respective window of the script, bcaz sometimes script fails to check the conditions..
Eg:
In Driver Program:
IF &KNA1-SPRAS& = 'EN'
IF &VBDKR-FKART& EQ 'L2' AND &VBDPR-MTART& NE 'DIEN'.
call function 'WRITE_FORM'
EXPORTING
element = 'DEBIT'
window = 'GIve the window name'.
ELSEIF &VBDPR-MTART& EQ 'DIEN'.
call function 'WRITE_FORM'
EXPORTING
element = 'INVOICE'
window = 'GIve the window name'.
INVOICE
ENDIF.
In Script Form:
/E DEBIT
P1 TR Debit Memo
/E INVOICE
P1 INVOICE
or
try by putting (C) in all the variables::
/: IF &KNA1-SPRAS(C)& = 'EN'
/: IF &VBDKR-FKART(C)& EQ 'L2' AND &VBDPR-MTART(C)& NE 'DIEN'.
P1TR Debit Memo
/: ELSEIF &VBDPR-MTART(C)& EQ 'DIEN'.
P1 INVOICE
/: ENDIF -
I want to stop loop through push button forms 10g
I want to stop looping through push button forms 10g it is like (SwingWorker() in java) (DoEvent() in .net)
The problem in forms 10g that when you start looping the form will freeze and you can't push any button on form, I found solution for that in form 6i through package d2kwutil **WIN_API_UTILITY.InterruptCheck(hButton)**
But in 10g I can't find solution, Please help>>>>>
declare
hButton PLS_INTEGER;
begin
:interruptcheck.counter := 0;
hButton := get_item_property('INTERRUPTCHECK.PB_OFF',WINDOW_HANDLE);
go_item('interruptcheck.loopcount');
set_item_property('INTERRUPTCHECK.PB_OFF',ENABLED,PROPERTY_TRUE);
set_item_property('INTERRUPTCHECK.PB',ENABLED,PROPERTY_FALSE);
set_application_property(CURSOR_STYLE,'HELP');
set_application_property(CURSOR_STYLE,'<d2kwut60>WAIT');
for i in 1..:interruptcheck.loopcount LOOP
if WIN_API_UTILITY.InterruptCheck(hButton) then
exit;
end if;
:interruptcheck.counter := i;
synchronize;
end loop;
set_item_property('INTERRUPTCHECK.PB_OFF',ENABLED,PROPERTY_FALSE);
set_item_property('INTERRUPTCHECK.PB',ENABLED,PROPERTY_TRUE);
set_application_property(CURSOR_STYLE,'DEFAULT');
end;
Edited by: wael amar on May 1, 2010 11:03 PMOk, here's a working testcase.
The idea is taken from an article from an oracle magazine (i don't have it at hand, , so i tried to rebuild it by "memory". As far as i remember the original was from the german doag-magazine and was written by Gerd Volberg).
Procedure to do the looping:
PROCEDURE PR_DO_THE_LOOP IS
nNumberInOneStep NUMBER:=2;
tm TIMER;
BEGIN
DEFAULT_VALUE(0, 'GLOBAL.INDEX');
IF :GLOBAL.INDEX=0 THEN
-- Didn't run yet, determine the max count
:GLOBAL.MAX:=10000;
END IF;
LOOP
-- Do the looping stuff
-- Decrease counter
nNumberInOneStep:=nNumberInOneStep-1;
-- Increase globale counter
:GLOBAL.INDEX:=:GLOBAL.INDEX+1;
-- Exit conditions
EXIT WHEN nNumberInOneStep=0;
EXIT WHEN TO_NUMBER(:GLOBAL.INDEX)>=TO_NUMBER(:GLOBAL.MAX);
END LOOP;
-- reset index at end
IF TO_NUMBER(:GLOBAL.INDEX)>=TO_NUMBER(:GLOBAL.MAX) THEN
:GLOBAL.INDEX:=0;
ELSE
-- start timer for next iteration
tm:=CREATE_TIMER('TM', 10, NO_REPEAT);
END IF;
END;The WHEN-TIMER-EXPIRED-trigger
IF :GLOBAL.INTERRUPTED='Y' THEN
MESSAGE('Interrupted at index ' || :GLOBAL.INDEX);
ELSE
PR_DO_THE_LOOP;
END IF;The WHEN-BUTTOn-PRESSED-trigger on the interrupt-button
:GLOBAL.INTERRUPTED:='Y';The WHEN-BUTTOn-PRESSED-trigger on the "start"-button
:GLOBAL.INTERRUPTED:='N';
PR_DO_THE_LOOP; -
Delete Functionality in manual tabular form
Hi everyone,
I have created 2 tabular forms on the same page.everthing is working fine.Both the tabular form are able to insert and update.I am getting problem to implement the DELETE functionality in those tabular form.
I inserted this code htmldb_item.checkbox(6, id) del in the region and i created a delete process.But i am getting (no data found) error.
could anyone help me in solving this.
thanks
phani
===========================================================
DELETE PROCESS:
FOR i in 1..HTMLDB_APPLICATION.G_F01.count
LOOP
DELETE FROM (TABLE NAME)
WHERE id = HTMLDB_APPLICATION.G_F06(i);
END LOOP;
=============================================================
TABULAR FORM 1:
REGION:
select x.column1,
x.column2,
x.column3,
x.column4,
x.column5,
x.del,
x.cks
from (
select htmldb_item.hidden(1,column1) column1,
htmldb_item.text(2,column2,10) column2,
htmldb_item.text(3,column3,10) column3,
htmldb_item.text(4,column4,10) column4,
wwv_flow_item.date_popup(5,null,column5) column5,
htmldb_item.checkbox(6,column1) del,
htmldb_item.md5_checksum(column2,column3,column4,column5) cks
from TABLENAME
union all
select htmldb_item.hidden(1,null) column1,
htmldb_item.text(2,null,10) column2,
htmldb_item.text(3,null,10) column3,
htmldb_item.text(4,null,10) column4,
wwv_flow_item.date_popup(5,null,null) column5,
htmldb_item.checkbox(6,null) del,
htmldb_item.md5_checksum(null,null,null,null) cks
from dual) x
==================================================================
PROCESS:
declare
l_cks wwv_flow_global.vc_arr2;
j pls_integer := 1;
begin
-- Get original MD5 checksum
select wwv_flow_item.md5(column2,column3,column4,column5) cks
BULK COLLECT INTO
l_cks
from TABLE;
-- Compare the original checksum, l_cks,
-- with submitted checksum, htmldb_application.g_fcs.
-- If they are different, raise an error.
-- for i in 1..l_cks.count
-- loop
-- if htmldb_application.g_fcs(i) != l_cks(i) then
-- rollback;
-- raise_application_error(
-- -20001,
-- 'Current version of data in database has changed '||
-- 'since user initiated update --process.');
--return;
-- end if;
-- end loop;
-- update
for i in 1..htmldb_application.g_f01.count
loop
if htmldb_application.g_f01(i) is not null then
update TABLENAME
set column2= htmldb_application.g_f02(i),
column3 = htmldb_application.g_f03(i),
column4 = htmldb_application.g_f04(i),
column5 = htmldb_application.g_f05(i)
where column1 = htmldb_application.g_f01(i);
else
if htmldb_application.g_f03(i) is not null then
insert into TABLE
(column2,
column3,
column4,
column5
values
(htmldb_application.g_f02(i),
htmldb_application.g_f03(i),
htmldb_application.g_f04(i),
htmldb_application.g_f05(i));
end if;
end if;
end loop;
end;
I created the other tabular form on the same page with
htmldb_application.g_f11(i)
htmldb_application.g_f12(i)
htmldb_application.g_f13(i)
htmldb_application.g_f14(i)
used the same code.Have you got any response on this? I would like to know how to do it too. I am trying to implement a manual tabular form on a page and need this functionality.
I do know one thing. After attending the ODTUG conference last week, Raj said something about you have to process check boxes and radio groups separately from the rest of the form.
Thanks,
Michelle -
Hi all,
I need department wise running total in forms
Like this
EmpNo EName DeptNo Sal RunTotal
1234 Test1 10 500 500
1235 Test2 10 600 1100
1236 Test3 10 1000 2100
1237 Test4 20 800 800
1238 Test5 20 600 1400
But i need it on form not on report or SQL have any idea please reply me promptly, i will also work if i enter new record..
Best regards
R E H A N M I R Z AHi,
(1) Add a control item to your form, e.g. RUNNING_TOTAL.
(2) Set the property 'Calculation Mode' for this item to 'Formula'.
(3) Set the property 'Formula' for this item to 'CALC_RUNNING_TOTAL;'
(4) Add a program unit 'CALC_RUNNING_TOTAL' to your form.
In this program unit you can use the SQL-query to retrieve you running total. Make use of the system variables :SYSTEM.CURSOR_RECORD and the same ORDER BY and WHERE clause as you have in your :SYSTEM.CURRENT_BLOCK.
Better is not to use the SQL-query, but make a loop (use Forms built-ins FIRST_RECORD, NEXT_RECORD and LAST_RECORD) and calculate the running total in that way.
HTH
Lennart de Vos -
How to eliminate a ground loop with SCXI units
I am using a SCXI chasis, the SCXI-1102 and 1303 and a 1602 USB interface. these are connected to grounded thermocouples fixed to an experimental apparatus. How do I eliminate the ground loop that forms when I power up my laptop (w/ 120V power) and to get accurate TC data? things work find when the laptop is running on batteries, but I don't have that much battery power!
Hi Gogden,
I have you tried hooking up the thermocouples differentially? This might eliminate the problem. Also, if you could give me some more information about the noise it might help me troubleshoot the problem better. Sometimes theres some noise due to lower quality power connectors on some laptops. This is typically associated with a 60Hz noise. Most of this is seen through a small audio hum when trying to amplify audio coming from laptops but it might be affecting the grounding of your USB DAQ card. You might try one of these audio hum eliminators around which may solve the problem. If you search google for "audio hum eliminator", you will find a variety of products for it. In conclusion, I would first recommend trying differentially and if that doesn't fix the problem you might look into the ground loop eliminator products out there.
Regards,
Paul Cason -
Form processing in JSP with array elements
Is there a class or object in JSP (No beans JSP only) I can call to reference a HTML Form and its elements. I want to perform database insert using data from an dynamically generated form. The form will generate N rows (based on parameters pass from the previous page) and I want to perform N inserts into a database based on the data from the N rows.
I've done something similar in javascript, using the document.form[0].elements[j]value to pass data within a for loop running form[0].elements.length times.
[email protected]
ku916
ThanksI may not understand your question correctly. I assume that you already have the code to generate the html form, you just need code to access entered values once the form is submitted right?
One way you can do this is to use the request.getParameterNames method. This would be easiest if there is only one entry field per row. For instance if you have N text boxes on your page, and the form is submitted, you can use request.getParameterNames to get an iterator of all the names of the text boxes. You can use this iterator to get all the values. Notice that the name of the fields here is irrelevant.
Enumeration names = request.getParameterNames();
while (names.hasNext()) {
String curVal = (String) names.nextValue();
//--- insert record for curVal
If there are multiple entry fields for each row, its slightly more difficult. I can recommend one approach. Name all the fields with a naming scheme.
The first field in the first row would be 1Field1, the second field in the first row would be 1Field2, etc. The first field in the second row would be 2Field1, the second field in the second row would be 2Field2, etc. Then its just a matter of using two for loops in your next JSP to iterate over all the records and fields. You might make it easy for yourself by writing the number of rows in a hidden field on the form. The insertion might look like this:
int numRows = Integer.parseInt(request.getParameter("numRows"));
for (int i = 0; i < numRows; i++) {
String sql = "some sql...";
for (int j = 0; j < fieldNum; j++) {
sql += request.getParameter(i + "Field" + j);
//-- perform insert
My sql generation is horridly abbreviated but hopefully you get the idea.
I am sure there are other ways to do this, maybe this will work or get you thinking. -
Please help with dynamic form field names in cfloop
Hi,
I need to create a form with day, date, month, year and time for 12 months
Instead of coding them 12 times, I create day,date,month,year and time fileds in my form 1 time and then I use cfloop from="1" to="12" index="i" to loop these form fields 12 times.
I gave each form field name such as: <input type="text" name="ScheduleDate_# i #" value=" "> this way each of those field will be named differently such as:
ScheduleDate_1, ScheduleDate_2,ScheduleDate_3, ScheduleTime_1,ScheduleTime_2, etc
I'm facing problem when this form is submitted, I think the error has something to do with the pound sign (##) when it comes to updating the back end
I use MS SQL
It doesn like this:
<CFLOOP From="1" To="12" index="k">
<CFIF Len(Trim(Form.MeetYear_#k#)) NEQ 0 AND Len(Trim(Form.MeetTime_#k#)) NEQ 0>
<cfquery name="CreateSchedule" datasource="#DSN#">
UPDATE TableSchedule
SET SchedDay = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedDay_#k##">,SchedMonth =
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedMonth_#k##">,SchedDate =
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedDate_#k##">,SchedYear =
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedYear_#k##">,SchedTime =
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedTime_#k##">
Where SchedId = <cfqueryparam cfsqltype="cf_sql_numeric" value="#k#">
</cfquery>
</CFIF>
</CFLOOP>
Can anyone help please?You can't nest hash marks. Do this instead:
SET SchedDay = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form["SchedDay_" & k]#">
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/ -
Looping insert...To be continued
Sorry, but the post was getting too long to follow so I
thought I would
start it over and ask for help piece by piece so I can learn
this:
I viewed the created html from Coldfusion and my list has
unique input names
from the looping list (List1, List2, etc) and the values are
unique due to
the recordset values of the listsid.
Ok, using cfdump var="#form#" I am getting nothing in the
output.
If I dump var = "#email#", I get the correct email addresse
twice.
I don't know how to dump the values of the lists because of
the fact that
they are incrementing dynamically based on the loop. I should
figure out
that to see if the numbers are correctly apprearing.
Here is my form:
<form action="" method="get" name="showMeMy">
<cfoutput>
cfset i = 0>
<cfloop query="optionList">
<cfset i = i+1>
<input name="list#i#" type="checkbox" id="list#i#"
value="#optionList.listid#">
#optionList.listName#
</cfloop>
input name="email" type="hidden" id="email"
value="#URL.email#" />
input name="Update" type="submit" id="Update" value="Update
Subscription
List">
</cfoutput>
</form>Ok, i am beginning to see. I am looking at the cfloop list in
the docs.
So I need to replace the 'form.fieldname' with the actual
field 'list'?
How can I replace that with the name of 'list' since it is
incrementing
from the form?
Do I need to rename my fieldname in the form from list#i# to
something
static?
NO, you just need to put all the pieces together.
Look at the <cfdump var="#form#"> you posted earlier.
struct
EMAIL [email protected]
FIELDNAMES LIST1,LIST2,EMAIL,UPDATE
LIST1 9999
LIST2 1
UPDATE Update Subscription List
See the third line, there is a "field" named "FIELDNAMES" and
it
contains a list of all the fields that where submitted by the
form page.
<cfloop list="#form.fieldnames#" index="field">
This is going to loop over the list in the form.fieldnames
key
[LIST1,LIST2,EMAIL,UPDATE] and put each list value into the
variable
"field".
<cfif left(field,4) EQ "LIST">
This checks the value of the variable "field" in each loop to
see if it
starts with the string "LIST" thus this is one of the list
check box fields.
VALUES ('#form.email#', #form[field]#)
This inserts the values of form.email and the list field into
the
database. In each loop itteration #form[field] is going to
resolve to
form[LIST1] and form[LIST2] which in turn will resolve to the
following SQL
VALUES ('#form.email#', #form[field]#
VALUES ('[email protected]', 1)
VALUES ('[email protected]', 9999) -
Can we put subroutines within loops?
q] Can we put subroutines within loops?- i mean not the PERFORM Statement but the FORMENDFORM statement
Hi
If your question means .. calling Performs within Loops ?
Then its possible..
LOOP.
PERFORM P1. ( THIS IS OK )
ENDLOOP.
But this is not correct..
LOOP.
FORM P1.
ENDFORM.
ENDLOOP.
Thanks
Hope it Helps.
Praveen
Maybe you are looking for
-
Error Message: "A virus was detected in FILENAME. This file will not be uploaded"
I have been synching files using Creative Cloud Connect for many months. During the past few weeks, I get the message "Some files failed to sync". When I click on "Learn more", it has 3 files there and all have the message "A virus was detected in fi
-
Cost Center,Profit Center & Cost element report on 0COOM_C02 error
Hi, I developed a report in BW on 0COOM_C02 (Business Content ) cube on Profit Center,Cost Center & Cost Element as Hirerachy ....but the some values in BW report doesn't match with that of R/3 report Where was i missing.... I updated all the Hirer
-
Difference in printer spooling between 2 similar macs
I'm trying to figure out why there is a difference in how my 2 Macs spool a print file. Sending the same large (276mb) Photoshop file to the same printer (Epson 11880) connected directly (no print server)on same hardwired network using Bonjour, using
-
Abode Reader X Save Icon is grayed out.
I have a Lenovo x220 running Windows 7 and when I open a pdf in Adobe Reader X, it won't let me just "save". I can "save as" but I can not just save. The icon for saving is also grayed out. When I hit Ctrl + S, nothing happens. It will save under "sa
-
Computer is shutting down right in the middle of things rop
It was doing this about a month ago. Just completely shutting down in the middle of the internet, iphoto,etc. and it wouldn't go to sleep, but kick off. I took it to the apple store and they said it was the power supply and fixed it. Then yesterday,