LOOPING THROUGH THE BLOCK
Can anybody help me with an example or materail which explains how can we loop through a block in Forms 6i?
Also how we can loop through the details block pertaining to the master block and process those records also?
Thanks
The quickest way to do something is not to do it at all, and this looks like a good example of where you don't need to do anything - what I suspect you really need is a better design for your schema. What are you updating that requires an update on all child records and cannot simply be referenced when you query a child record?
If you can't change the schema and you have millions of records to update then your best bet is to use sql, then try pl/sql if sql can't do the job. Only try forms if you absolutely have to, and expect it to run like a brick.
In forms (assuming you're using relationships):
go to each block, do first_record and process each record.
go to the lowest child block and loop through the records using next_record until "system.last_record = 'TRUE'", processing each record as you go.
go to the next block up, do next_record and process that record.
go back to the lowest child block and loop though it, processing each record.
when you have reached the last record in the penultimate child block then go to its immediate parent block, do next_record and process that record.
go to the lowest child block etc etc etc
There are a lot of things which you can do in forms but which belong on the database!
Similar Messages
-
Multi-record block (how do I loop through the block)
I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
reports that they want to run. When they click on <NEXT> button, I create a multi-record
control block and display each record on the second screen using
go_block;
clear_block;
move data;
create_record;
The user then selects on the second canvas which reports to run now and which to run later via
a LOV. When they press the <RUN> button, I want to start at the first record and either run the
report or schedule it. Then I want to move onto the second and the third until all selected reports
have been handled. I know I should use a loop but can't seem to make it work.
So my question is, How do I loop through the records in a multi-record control block, pass the information
for that one record to a parameter form and then execute the request? Each control block record contains
10 parameter fields.
Thanks.
Bobgo_record(1);
<< do your processing >> -- This is executed only for the first record.
if :system.last_record = 'TRUE' then -- If the 1st record is also the last record.
RETURN;
end if;
LOOP
next_record;
<< do your processing >>
if :system.last_record = 'TRUE' then
EXIT;
end if;
END LOOP;
I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
reports that they want to run. When they click on <NEXT> button, I create a multi-record
control block and display each record on the second screen using
go_block;
clear_block;
move data;
create_record;
The user then selects on the second canvas which reports to run now and which to run later via
a LOV. When they press the <RUN> button, I want to start at the first record and either run the
report or schedule it. Then I want to move onto the second and the third until all selected reports
have been handled. I know I should use a loop but can't seem to make it work.
So my question is, How do I loop through the records in a multi-record control block, pass the information
for that one record to a parameter form and then execute the request? Each control block record contains
10 parameter fields.
Thanks.
Bob -
JDev 10.1.3.4: How to properly loop through the rows of a VO?
Hi,
This is a newbie question. Using JDeveloper 10.1.3.4 I am trying to loop through the rows of a view object. I am sure that the VO returns the following rows in that order:
200809
200902
200906If I use this code (where termsOpen is the VO instance):
while (termsOpen.hasNext()) {
System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
}it proves to be an endless loop and I get "200809" printed on the console endlessly. The API says that hasNext() "does not move the current row". A book says that the pointer initially is at row 0. I wonder why it prints the first row. So the code is changed to:
while (termsOpen.hasNext()) {
Row currRow = termsOpen.next();
System.out.println(currRow.getAttribute("Term"));
}But now I get only the last two rows printed on the console, and do not get to see the first row:
200902
200906What's wrong?
Thanks for helping!
NewmanHi, Branislav,
Thank you for the suggestion.
I tried that also. When the code is
while (termsOpen.hasNext()) {
System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
termsOpen.next();
}I get only the first two rows and last row is dropped:
200809
200902To get all the three row, I end up using this code:
System.out.println(termsOpen.first().getAttribute("Term"));
while (termsOpen.hasNext()) {
Row currRow = termsOpen.next();
System.out.println(currRow.getAttribute("Term"));
}But that shouldn't be the way of doing the work. If I use a block of 50 lines of code to process each row, the code will have to be written once before the while loop and another time inside the while loop.
The book which says that the pointer starts at the row slot before the first row is found on the internet, on p.469. It makes sense to me that the pointer starts at row 0. But unfortunately the actual copy of JDev 10.1.3.4 I am using behaves otherwise.
Newman -
Does anyone know a way to programatically loop through the items in the document library
A lot of the funcations like deleteSymbol and updateSymbol depend on which items are "selected" in the library panel.
Is there a way to programatically access these selections?
or
Loop through the library?
or
Set selections?Yup, I've asked for an API to access the selection in those panels for years, to no avail.
Note that you can loop through layers, frames and pages, but you can't tell what the user has selected in the actual panel UI. Also, you can't find out which symbols are currently used in the document. Nor can you programmatically insert a rich symbol into the document and have it maintain its "richness". -
Script code sample for looping through the records from xml data file in formCalc script
Hi
I have a xml data file which contains a sequence of repeating applicant data like given below
US
II
CEO
Mr
111111111
0000000111
GuarantorA
111
IN
11111
WILLIAMS1
R3
KENNETH1
City1GU
PA
1934-03-14
[email protected]
GU
R
113 Lazlo LaneCA
Suite 3500CA
OaklandCA
TX
11345
AL
I want to assign a textfield with a value based on the value of coap_flag.
So i need to loop through all the record and check the value of coap_flag and then assign the textfield a value based on that.
I am new to Adobe livecycle...Please help me how it can be done.
I have developed something like this
foreach Item in ($record.applicant[*].coap_flag) do
test.value=Item
if(test.value=="MA")then
concat($record.applicant.first_name,$record.applicant.middle_name)endif
endforUsing the data you posted in the forum, I copied it a couple of times to give multiple records and used this code to extract the different values that you wanted. I had to wrap it in a <root> node that I called root (to make it valid XML). In my case I wrote the extracted values to a field, but in your case you can do whatever you want with them. Note that this was done in javascript:<br /><br />var currentElement;<br />var obj;<br /><br />//Get the nodes below the root node in the dataDom<br />obj = xfa.datasets.data.root.nodes;<br /><br />//Set an initial value for the textField<br />TextField1.rawValue = "The values of the coap_flag are: ";<br /><br />//Loop through the nodes in the obj set <br />for (i=0; i< obj.length ; i++){<br /> //set the currentElement to the 1st child node<br /> currentElement = obj.item(i);<br /> //Check to see if it is an applicant node<br /> if (currentElement.name == "applicant"){<br /> //It is an applican, now find the coap_flag node value and write it to the text field<br /> TextField1.rawValue += "\n" + xfa.resolveNode("xfa.datasets.data.root.applicant[" + i + "]").coap_flag.value;<br /> }<br />}
-
Loop through the records from xml data file in formCalc script
Hi
I have a xml data file which contains a sequence of repeating applicant data like given below
US
II
CEO
Mr
111111111
0000000111
GuarantorA
111
IN
11111
WILLIAMS1
R3
KENNETH1
City1GU
PA
1934-03-14
[email protected]
GU
R
113 Lazlo LaneCA
Suite 3500CA
OaklandCA
TX
11345
AL
I want to assign a textfield with a value based on the value of coap_flag.
So i need to loop through all the record and check the value of coap_flag and then assign the textfield a value based on that.
I am new to Adobe livecycle...Please help me how it can be done.
I have developed something like this
foreach Item in ($record.applicant[*].coap_flag) do
test.value=Item
if(test.value=="MA")then
concat($record.applicant.first_name,$record.applicant.middle_name)endif
endforUsing the data you posted in the forum, I copied it a couple of times to give multiple records and used this code to extract the different values that you wanted. I had to wrap it in a <root> node that I called root (to make it valid XML). In my case I wrote the extracted values to a field, but in your case you can do whatever you want with them. Note that this was done in javascript:<br /><br />var currentElement;<br />var obj;<br /><br />//Get the nodes below the root node in the dataDom<br />obj = xfa.datasets.data.root.nodes;<br /><br />//Set an initial value for the textField<br />TextField1.rawValue = "The values of the coap_flag are: ";<br /><br />//Loop through the nodes in the obj set <br />for (i=0; i< obj.length ; i++){<br /> //set the currentElement to the 1st child node<br /> currentElement = obj.item(i);<br /> //Check to see if it is an applicant node<br /> if (currentElement.name == "applicant"){<br /> //It is an applican, now find the coap_flag node value and write it to the text field<br /> TextField1.rawValue += "\n" + xfa.resolveNode("xfa.datasets.data.root.applicant[" + i + "]").coap_flag.value;<br /> }<br />}
-
Hi,
I'm very new to Powershell but through the help of this forum and the help on the internet I have scraped together a script that will loop through the disks of a set of servers listed in a text document, and give the capacity statistics in html
format.
I have two questions. I've tried modifying this to also loop though the individual folders on each disk and give the amount of space used to no avail. does any one have any suggestions?
Secondly, how do I get this to append? all I want to do is set up a scheduled task that runs this report daily. I know I will need to add a date column, but I just want the data to append to the previous set of results.
Thanks for any advice in advance.
# Continue even if there are errors
$ErrorActionPreference = "Continue";
# Set your warning and critical thresholds
$percentWarning = 100;
$percentCritcal = 15;
# REPORT PROPERTIES
# Path to the report
$reportPath = "C:\";
# Report name
$reportName = "DiskSpaceReport_$(get-date -format ddMMyyyy).html";
# Path and Report name together
$diskReport = $reportPath + $reportName
#Set colors for table cell backgrounds
$redColor = "#FF0000"
$orangeColor = "#FBB917"
$whiteColor = "#FFFFFF"
# Count if any computers have low disk space. Do not send report if less than 1.
$i = 0;
# Get computer list to check disk space
$computers = Get-Content "C:\serverlist.txt";
$datetime = Get-Date -Format "dd-MM-yyyy_HHmmss";
# Create and write HTML Header of report
$titleDate = get-date -uformat "%d-%m-%Y - %A"
$header = "
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<title>DiskSpace Report</title>
<STYLE TYPE='text/css'>
<!--
td {
font-family: Calibri;
font-size: 12px;
border-top: 1px solid #999999;
border-right: 1px solid #999999;
border-bottom: 1px solid #999999;
border-left: 1px solid #999999;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
body {
margin-left: 5px;
margin-top: 5px;
margin-right: 0px;
margin-bottom: 10px;
table {
border: thin solid #000000;
-->
</style>
</head>
<body>
<table width='100%'>
<tr bgcolor='#0B6121'>
<td colspan='7' height='30' align='center'>
<font face='calibri' color='#E0F8F7' size='4'><strong>Daily Disk Utilization Report for $titledate</strong></font>
</td>
</tr>
</table>
Add-Content $diskReport $header
# Create and write Table header for report
$tableHeader = "
<table width='100%'><tbody>
<tr bgcolor=#E0F8F7>
<td width='10%' align='center'>Server</td>
<td width='5%' align='center'>Drive</td>
<td width='15%' align='center'>Drive Label</td>
<td width='10%' align='center'>Total Capacity(GB)</td>
<td width='10%' align='center'>Used Capacity(GB)</td>
<td width='10%' align='center'>Free Space(GB)</td>
<td width='5%' align='center'>Freespace %</td>
<td width='5%' align='center'>RAM %</td>
<td width='5%' align='center'>CPU %</td>
</tr>
Add-Content $diskReport $tableHeader
# Start processing disk space
foreach($computer in $computers)
$disks = Get-WmiObject -ComputerName $computer -Class Win32_LogicalDisk -Filter #"DriveType = 3"
$computer = $computer.toupper()
foreach($disk in $disks)
$deviceID = $disk.DeviceID;
$volName = $disk.VolumeName;
[float]$size = $disk.Size;
[float]$freespace = $disk.FreeSpace;
$percentFree = [Math]::Round(($freespace / $size) * 100);
$sizeGB = [Math]::Round($size / 1073741824, 2);
$freeSpaceGB = [Math]::Round($freespace / 1073741824, 2);
$usedSpaceGB = $sizeGB - $freeSpaceGB;
$color = $whiteColor;
# Start processing RAM
$RAM = Get-WmiObject -ComputerName $computer -Class Win32_OperatingSystem
$RAMtotal = $RAM.TotalVisibleMemorySize;
$RAMAvail = $RAM.FreePhysicalMemory;
$RAMpercent = [Math]::Round(($RAMavail / $RAMTotal) * 100);
# Set background color to Orange if just a warning
if($percentFree -lt $percentWarning)
$color = $orangeColor
# Set background color to Orange if space is Critical
if($percentFree -lt $percentCritcal)
$color = $redColor
# Create table data rows
$dataRow = "
<tr>
<td width='10%'>$computer</td>
<td width='5%' align='center'>$deviceID</td>
<td width='10%' >$volName</td>
<td width='10%' align='center'>$sizeGB</td>
<td width='10%' align='center'>$usedSpaceGB</td>
<td width='10%' align='center'>$freeSpaceGB</td>
<td width='5%' bgcolor=`'$color`' align='center'>$percentFree</td>
<td width='5%' align='center'>$RAMpercent</td>
<td width='5%' align='center'>$CPUpercent</td>
</tr>
Add-Content $diskReport $dataRow;
Write-Host -ForegroundColor DarkYellow "$computer $deviceID percentage free space = $percentFree";
$i++
# Create table at end of report showing legend of colors for the critical and warning
$tableDescription = "
</table><br><table width='20%'>
<tr bgcolor='White'>
<td width='10%' align='center' bgcolor='#FBB917'>No Warning</td>
<td width='10%' align='center' bgcolor='#FF0000'>Critical less than 10% free space</td>
</tr>
Add-Content $diskReport $tableDescription
Add-Content $diskReport "</body></html>"The only easy way to create a report like this that accumulates is to design it so the data is output to a CSV file or a database. YOu can then generate the HTML from the persist6ed data.
If you store as XML you can use XSLT (transform) to convert to an HTML report.
I also recommend uing Excel as an HTML report generator. It is much easier and more flexible. PowerShell is not intended to do what you want without designing a whole custom reporting system.
Use the right tool for the right task.
Just because you own a hammer does not mean that the solution to every problem includes a nail.
¯\_(ツ)_/¯ -
Post Author: Swapna
CA Forum: Formula
Hi
I need to loop through the result set how would i do that here is my scenario
in the database i have total 10 columns say an example
a,b,c,d,e,f,g,h,i,j,k and assume i have 100 rows with allthese values in the database now for these 100 rows i have to calculate the summary of those columns and i have written formula something like this but it was not working it was giving me zero dont know plz advise on this
whileprintingrecords;
numbervar totalsum;
totalsum=totalsum((a-b)/100cdefghi-j-k);
and i want to display this sum in my detail section of report how would i do that
I Appreciate your help.Post Author: SKodidine
CA Forum: Formula
Try this and see if you get any results.
totalsum=totalsum((a-b)/100cdefghi-j-k);
totalsum := totalsum((a-b)/100cdefghi-j-k); -
How to loop through the "On My Mac" folders in mail?
Hi there - i am new to applescript, but am slowly working out how to use it.
I am stumped on how to write a rule that will move a message to a folder identified by a tag in a message (I am using MailTags).
I have script that will take the first tag and move the message to a mail folder in a fixed location (e.g. Archive/<tag name>) however I wanted to make it more generic by looping over all of my mail folders and finding one that matched the tag name.
However I am stumped on how to loop over all of my mail folder names - I have tried:
repeat with aFolder in (every mailbox of (mailbox for "ON MY MAC"))
and
repeat with aFolder in every mailbox of inbox
etc.
but none of these seem to work.
Is there some magic syntax to do this, so that I can do:
if (name of aFolder = msgTag) then
move oneMessage to mailbox (name of aFolder)
end if
TimYou don't necessarily need to assign a variable to the entire list in order to loop through them (unless you really want to) - for example:
tell application "Mail" to repeat with aFolder in (get mailboxes)
-- do stuff with aFolder
end repeat
There are several AppleScript resources, but the main ones I use are:
AppleScript Language Guide
AppleScript Tutorials at MacScripter.net -
Loop through the excel files in folder and sub folder
hi all
I need to loop through all the excel fies in a folder and its sub folder which contain excel files
actually, my excel files contain a column with sdate and it contain different dates in which has to get the max date my query is
"select * from @[User::filename] where sdate=(select max(sdate) asi from @[User::filename] )"
loop all the excel file in folder and its sub folderTake a look at the Foreach Loop.
Here is an article about it.
Andy Tauber
Data Architect
The Vancouver Clinic
Website | LinkedIn
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
"Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread. -
Loop through the collection of elements and give 15 elements in each iteration.
For example I have 100 pnr numers and i need 15 set of pnrs each time i iterate through the 100 pnrs using XQUERY.
I have to hit a service to get PNR details , I have 100 PNR's but I can hit only with 15 at a timeHello,
Did the issue resolved? Just as Visakh16 post above, it is hard to interpret without the sample data. Please post more details for further analysis.
You can refer to the following article about FLWOR Statement and Iteration in XQuery:
http://technet.microsoft.com/en-us/library/ms190945.aspx
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
Ipod nano would'nt play, just kept looping through the songs.
My nano is only six weeks old. It was playing fine but then suddenly stopped playing and would only go through the songs and then go back to the main screen. I just wondered if anyone ever experienced this same problem.
i had the same problem and i couldnt figure out what to do so i sent it back to apple and i got it back within a week and it worked fine but all my music was off of it. but it worked and it was free.
-
How to remove the simulation loop from the block diagram
hi,
i have used lap view version 8.6 to design pid system. i have the pid block diagram with daq on simulation loop. now my supervisor want me to remove the simulation loop. anyone know how to remove the simulation loop without deleting the pid block diagram. i have attached my pid program.
Attachments:
Copy of LAP VIEW FINAL for engine dyno.vi 221 KBlogaraj wrote:
hi,
i have used lap view ( ) version 8.6 to design pid system. i have the pid block diagram with daq on simulation loop. now my supervisor want me to remove the simulation loop. anyone know how to remove the simulation loop without deleting the pid block diagram. i have attached my pid program.
You cannot remove the simulation loop alone because all the functions kept inside that loop will work inside that loop only. If you have to remove means then you have to find another way to inplement the PID control.
The best solution is the one you find it by yourself -
Hi Experts,
I have a requirement where we do not want to use screen flow and instead build appropriate logic in rulebase document.
Original Requirement Detail: (Simple)
Attribute_1 is shown to the user as drop down on a screen and available options in the drop down are "Form 1", "Form 2" and "Not Now". Suppose Attribute_1 is set with value "Form 1" then, user is taken to "Screen 1". Similarly if Attribute_1 is set with value "Form 2" then, user is taken to "Screen 2". Only if user selects "Not Now", investigation ends and user navigated back to "Summary" screen with outcome. If "Screen 1" or "Screen 2" rule fails, the investigation ends and user is navigated to summary screen.
Modified Requirement that made things complex:
After Attribute_1 is set with value "Form 1" then, user is navigated to "Screen 1" and after executing the "Screen 1" now it is expected to bring back to the screen with drop down where he can re-select "Form 2".
Is is possible to loop check and bring the user back to the screen from where he selected this option?
Thanks,
VinayYou first 'simple' example can be addressed with some procedural rules, e.g.
the interview is complete if
…..both
…..…..the user selection = "Form 1" and
…..…..the Form 1 data has been collected
…..or
…..both
…..…..the user selection = "Form 2" and
…..…..the Form 2 data has been collected
…..or
…..the user selection = "Not Now"
the Form 1 data has been collected if
…..it is known whether or not the person is happy
the Form 2 data has been collected if
…..it is known whether or not the person likes summer
If you want the user to be able to investigate both Form 1 and Form 2 in the same interview session, then they cannot be selecting the Form from a drop-down list. A drop-down list associated with a variable (e.g. “the user selection” in the example above) represents a single value. It can’t be equal to both “Form 1” and “Form 2” in the same interview. If you need to offer the user the option of investigating both forms in the same interview, then I suggest using a Boolean for each. If you’re using a recent point release of OPA 10.4.x, then you could even make these Booleans checkboxes, e.g.
Screen: Form Selection
Does the user wish to investigate Form 1?.....[ ]
Does the user wish to investigate Form 2?.....[ ]
You don’t need to have a ‘not now’ option. If the user submits the screen without checking any boxes then you can interpret that as the user choosing not to investigate either of the forms.
The associated procedural rule for this second example could be something like this:
the interview is complete if
…..either
…..…..the user does not wish to investigate Form 1 or
…..…..both
…..…..…..the user wishes to investigate Form 1 and
…..…..…..the Form 1 data has been collected
…..and
…..either
…..…..the user does not wish to investigate Form 2 or
…..…..both
…..…..…..the user wishes to investigate Form 2 and
…..…..…..the Form 2 data has been collected
Cheers,
Jasmine -
How to create an apex collection to store and loop through the values
I couldn't find any simple example to do this
Apex 4.2
I need to create an apex collection. I have a query that returns multiple roles for a user. I need to check to see if one of my item values is within the collection but am not sure how to do so. So far I have:
begin
APEX_COLLECTION.CREATE_COLLECTION (
p_collection_name => 'ALL_ROLES');
select count(granted_role) into count from dba_role_privs where upper(grantee) = upper(:APP_USER);
end;
How would I store the query results in the collection?Trying to understand your code and a better suggestion:
declare
is_viewable boolean;
v_count number;
l_query varchar2(2000);
i_counter number(10) :=1;
begin
--l_query := 'select granted_role from dba_role_privs where upper(grantee) = upper(:APP_USER)';
--why do you need a collection, this is a simple select count(1) question
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY (
p_collection_name => 'ALL_ROLES',
p_query => l_query,
p_generate_md5 => 'YES');
-- You create a collection, but where are you using it?
-- select count(granted_role) into count from dba_role_privs where upper(grantee) = upper(:APP_USER);
-- discard the above code
-- If you want to see how many elements in a collection
-- determine # of elements in a collection
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_collection.htm#CJAFFEAH
v_count := APEX_COLLECTION.COLLECTION_MEMBER_COUNT ('ALL_ROLES');
IF :P32_SUBMISSION_DATE IS NOT NULL THEN
begin
select count(granted_role) into v_count
from dba_role_privs
where upper(grantee) = upper(:APP_USER) and
granted_role in ('SURVEY_SUID','SURVEY_JOB_SUID');
exception
when no_rows_found then
v_count := 0;
end;
if v_count > 0 then
is_viewable := true;
else
is_viewable := false;
endif;
else
is_viewable := false;
endif;
return is_viewable;
end;Thank you,
Tony Miller
Ruckersville, VA
Maybe you are looking for
-
How to insert a JPG image in a column of type "image" in sql server 7.0 ??
hi all, I have a table with 2 columns. First col is of "Name" and second col is of type "image" . I am using sql server 7.0 on window 2000. now i have created table. I want to insert a jpg/gif image in its 2nd column. How can i do so ? and how i can
-
Sales Doc Overall status not updating in DSO
Hi All, In ECC status of the Sales Document has changed from B to C. However in the DSO status still shows as C. Delta has pushed through successfully. Please see the screenshot below. Why is the status not changing in DSO? How to handle this issue?
-
Hanging (I think) on startup
I just got my iMac the other day (first time Mac user, so pardon my failure to use the lingo), and I finally got around to opening iTunes for the first time last night. When I launch the program, though, the iTunes GUI comes up, but the spinny-rainbo
-
Do some app publishers allow use of both the iPad and iPhone versions, even if one is coded differently for the iPad? Buy one and get both.
-
Converting iPad publication for Android
I've developed iPad versions of digital magazines but now we want to make them available to the Android market. I know Viewer Builder will create the Android app, but in terms of screen size/aspect ratio, how does that work? With different tablets ha