Looping through each record
Hi everyone
I am new in crystal reporting and using Crystal Reports XI release 2. Firstly I should explain what I need to have. In my database I have got a parent table called Initiatives and a child table called benefits. One initiative has got many benefits associated with it and benefits are updated regularly by the users. Now my manager wants me to create an Initiative reports in such a way that all the initiatives are displayed and against each initiative there should be a box filled with either of these colour (red, yellow, green).
Let's say if Initiative "X" has got 10 benefits and if one or more benefits are outstanding by more than 2% then the colour of the box should be red. And if no benefit is outstanding by more than 2% and one or more benefits are outstanding more then 1% and less then 2% then colour of box should be yellow. And if no benefit is outstanding more than 1% then colour of box should be green.
Now for this I have created a report displaying all initiatives and a sub report with a SQL command containing the data from the benefits table. I have also included a database field which I would use as a box.
Now I want to loop through each record of the crystal report till the last record and format the field as per condition. I would probably use nested loop to look for the status of the benefits but I don't know how to do this in CR. In short I am looking to do this thing in CR
While Recordset.EOF
Do
But I can't find a key word for EOF or count-1 or some thing like that.
Seeking the help of you guys.
Regards,
It would be much easier to simply let Crystal's conditional formatting do this for you.
Almost every formatting aspect of each object in Crystal can be controlled via expressions. Just click on the expression button to the right of the property...
ido
Similar Messages
-
Calculate Days between same date field in multiple records, looping for each record
Be patient as I am a newbie to Sql Server (using 2008 R2) and SSIS. I have looked at multiple solutions in this and many other forums before submitting the question.
I am looking at records to identify the number of days between two dates. We review drug information. A member uses drug A (Code identifies this called GPI) and has refills throughout time. The goal is to calculate the days between Refill
1 and refill 2, then refill 2 to refill 3, etc. When that member record set is complete, we move to the next member record set.
The basic data would be as follows. Each record shown below would be a separate record in a single table :
Member
Drug Code
DateService
Days Between
1
A
3/1/2012
0
1
A
3/27/2012
27
1
A
4/21/2012
26
1
A
6/15/2012
56
1
F
2/25/2012
0
1
F
3/20/2012
25
1
F
4/17/2012
29
1
F
8/1/2012
107
5
B
2/15/2012
0
5
B
3/10/2012
25
5
B
4/10/2012
32
5
B
6/28/2012
80
5
B
7/10/2012
13
5
B
8/20/2012
42
The days between is the value I am looking to calculate. The First record for the grouping of Member and Drug Code will be zero ( 0 ) as there is no preceding date to calculate against. The process would then loop through the records at the grouping
(Member and Drug Code) until those records are calculated. It would then move on to the next group of Member/Drug records.
Any assistance would be greatly appreciated. Any clarification I can provide, I would be more than happpy too. Thank you in advance!TSQL- Finding the difference in days of multiple records in SQL ServerWITH OrderDates AS (
SELECT
ROW_NUMBER() OVER (ORDER BY OrderDate DESC) AS RowNumber,
OrderDate
FROM OrdersTable
WHERE SKU = 'AA0000'
SELECT
AVG(DATEDIFF(DD, O2.OrderDate, O1.OrderDate)) AS AverageFrequency
FROM OrderDates O1
LEFT JOIN OrderDates O2
ON O2.RowNumber = O1.RowNumber + 1
Fabio Bilicki -
How do I move through each record?
I want to use some math function on one field and store the result in the other field one record at the time.
How can I do it?How do I move through each record?
I want to use some math function on one field and store the result in the other field one record at the time.
How can I do it? You can read about Analytic Functions. It sounds like the one you want is either LAG or LEAD.
LAG
http://technet.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a90125/functions54.htm#83619
LEAD
http://technet.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a90125/functions58.htm#83836
Different Function including Analytic
http://technet.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a90125/functions2.htm#81312
Good Luck,
TwoPigs -
Custom pll to disable form messages while looping through block records
I need to loop through block records in CUSTOM pll to check for if one check box is checked or not. But in that process the messages written at the forn level are popping up which are of no use to the user. I want to disable the messages for my looping. I would enable it after the processing in CUSTOM PLL
Regards,
SSHello,
Here is the Forms forum, and you would increase chances to get an answer by posting in the EBS forum.
Francois -
GeoRaster- loop through each cell and execute spatial query?
Hi,
So what I want to do is, to loop through each cell in a raster and get the ground x,y coordinates. Then based on the x,y value I want to execute a query on a vector layer.
My question is, how do I find each cell coordinate? That I will then use with SDO_GEOR.getModelCoordinate to get the ground coordinates, query vector, etc...
Thanks.I am not sure what you want to do. Why not just use the spatial extent of the GeoRaster object?
Anyway, say sdo_geor.getULTCoordinate returns (r0, c0, b0), and sdo_geor.getSpatialDimSizes returns (rows, cols). The range of the cell coordinates (at the original image level) are:
row: r0 -- r0+rows-1
column: c0 -- c0+cols-1
Regards,
Terry -
How to loop through xml records from file without ROW , /ROW tags?
I am using dbms_XMLSave.insertXML procedure to insert xml formated record from file. MY xmlformated records does not have open and close ROW tags. I have multiple records in the file.How can I loop through without <ROW>,</ROW> tags?
I am using dbms_XMLSave.insertXML procedure to insert xml formated record from file. MY xmlformated records does not have open and close ROW tags. I have multiple records in the file.How can I loop through without <ROW>,</ROW> tags?
-
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 />}
-
I was wondering how I can loop through all records in a database?
I'm using a do while loop to loop through all the records in a database is there a way I can simulate to EOF. I tried something to simulate it but I don't think it'll work. I assume there's a better way.
Here's my code:
boolean noRecords=false;
do
noRecords=false;
if (queryResults.next())
serverOutput.print(queryResults.getInt("itemID");
serverOutput.println(queryResults.getString("itemName");
else
noRecords=true;
}while(noRecords==false);i think i know what you mean...
try this
while (queryResults.next()) {
serverOutput.print(queryResults.getInt("itemID");
serverOutput.println(queryResults.getString("itemName");
when .next() returns false, it will exit the while loop. you don't need the other code you have there, the above should do it all.
is that what you're after? -
Looping through several records where some share a primary key.
Can anyone help me write this code... (fix as is, or restructure). I'm trying to perform methods on various objects which share a primary key (as I iterate through them), then a final method when the last matching primary key is met (they are present in grouped order), however I'm stuck at the new primary key when I want to use the old grouping (grouping code not shown).
Sring primaryKey = "P1";
for (MyRecord x : myArrayList) {
while (s.getPKey() == primaryKey) {
// perform operations ... add results to array list 'y'
} else {
primaryKey = s.getPKey();
// Here's the kicker: PERFORM METHOD ON OBJECTS FROM PREVIOUS LOOP --
performMethod(NOT ON THIS array list Y-- LAST array list Y)
}EXAMPLE:
P1
P1
P1
P1
P2
P2
P3
P3
P3
P3
P4present in grouped order), however I'm stuck at the new primary key when I want to use the old grouping (grouping code not shown).1. Normally a primary key means just 1 object associated with that key
2. See the line above. You have posted code, then you say "this code is a problem. Code I haven't shown you is my problem" How are we supposed to help you? -
How to loop through xml records and repeatedly display
I have 1 table in my rtf and the table typically reflects 1 row (grouping) from my xml data, however there are some instances where i need to take 1 row from my xml data and display the table multiple times.
i.e.
xmldata:
item TOTAL_QTY CONTAINER_QTY
x 500 250
I need to take that row and display the table in my rtf two times. I tried to encapsulate my table in a <?for-each:xdoxslt:foreach_number($_XDOCTX,0,TOTAL_QTY,CONTAINER_QTY)?> loop looping/re-displaying the table until a reach TOTAL_QTY, but once I'm in this loop it's like i dont have access to the actual xml data fields. How can I achieve this effect?1. Please tell us your first name and put it in your handle and/or profile to help us.
2. Explain your question in more detail, perhaps with an example and by showing code you already are using.
Scott -
How to loop through report records and update the record
I have a updateable report. And there is a select LOV in that report. How to loop though the report and save all the changes to the LOV.
1. Please tell us your first name and put it in your handle and/or profile to help us.
2. Explain your question in more detail, perhaps with an example and by showing code you already are using.
Scott -
Trying to loop through records
Hi
I trying to loop through my records and write to a database each time, but my code only seems to write the first time through...
//check for the stock levels...
Iterator stockLevels = getItems().iterator();
pstmt = dbConn.prepareStatement(sql_bundle.getString("findStock"));
while (stockLevels.hasNext()) {
CartItem stockL = (CartItem) stockLevels.next();
pstmt.setString(1, stockL.getProduct().getISBN());
ResultSet rscp = pstmt.executeQuery();
if(rscp.next()){
if (rscp.getInt("STOCK_LEVEL") > stockL.getQuantity()) {
int newAmount = rscp.getInt("STOCK_LEVEL") - stockL.getQuantity();
PreparedStatement pstmte = dbConn.prepareStatement(sql_bundle.getString("updateStock"));
pstmte.setInt(1, newAmount);
pstmte.setString(2, stockL.getProduct().getISBN());
pstmte.executeUpdate();
} else {
cat.error("Right Bloddy mess");
throw new Exception();
}else{
throw new Exception("No results from known good query.");
pstmt.close();I get the following error in my browser:
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
and no errors when I compile using javac...
Thanksexcellent my looping is working...
thanks -
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 -
Looping through records without hardcoding column identifiers
Is it possible to call a nextval type function when looping through a recordset?
I have a cursor which fetches records into a %rowtype variable. However, I was wondering is it possible to go through each record without having to call the column name, but rather incrementally moving from record to record
i.e.
cursor x is
select a,b,c from d;
record x%rowtype;
open x;
loop
fetch x into record;
htp.p(x.nextval (or its equivalent));
exit when x%notfound;
end loop;
is this possible instead of
htp.p(x.a);
htp.p(x.b);
htp.p(x.c);
ThanksYou probably want to hard-code the column names in your code.
The alternative would be to use dynamic SQL and the DBMS_SQL package. That would drastically complicate the code, however, so it's generally not a great idea.
Justin
Maybe you are looking for
-
Quicktime 7.2 MS Visual C++ Runtime Library Error "Buffer Overrun Detected"
HIGHLY DISSATISFIED just shelled out the $30 for Quicktime PRO and I can't use it. Please help when I attempt to run .mov files captured by my digital camera it begins to pixelate badly only a few seconds in and then stops completely and crashes givi
-
Dear Sir, We are using Measurement Studio 8.5 for Visual Studio 2005. Our application reads 105 Netwrok Variables in every seconds. It does the the work done through NetworkVariableDataSource.Bindings[VariableName].GetValue(). So far we have tested a
-
Javascript stopped working -- Firefox Ver.28
This is an FYI -- - My Firefox installation was updated to version 28 on March 18th. - Early this morning while working on a web site javascript stopped working on my home computer. - I finally realized that it was working on my office computer (also
-
How to start SNMP on LDAP Dir. server ? Is that runs on port 161 ?
When I click 'SNMP' tab on configuration it says "The snmp service has been started" But when I try to stop or restart it says, "Error occured while stop/restating subagent. Check the configuration data you entered" Where do I check the config. data
-
Working with Right Click Events
I would like to configure the Event Structure to recognize not only mouse down but the differance between left mouse button down and right mouse button down. i.e. I'd like to be able to fire individual events for either left/right mouse buttons. Does