Need to create report based on criteria between a range of dates

I am very new to Numbers '09 and a beginner with spreadsheets.  I've searched and can't find a formula that fits this.  I've tried Match/IF  Match/Index  VLookup  If/And formulas but can't get the right results.
I need to be able to create a report based on data from Master Spreadsheet.  I need formulas that will populate Report Page B8:B17 and D8:D17 from data in Master Spreadsheet that meets criteria range of dates (Report Page B5 and B6).
The closest I've come was an IF(AND formula, but that left blank lines on my report page.  (I understand why, just not sure how to resolve it.)
P.S.  I am working in Numbers '09 on an iPad (yes, the samples below are not in the Numbers program, but it was easier to do screen shots on my Mac notebook
Master Spreadsheet:
Report Page:

Hi KC,
So you are trying to retrieve the dates and associated comments for a specific student in a specific class between the two dates.
Here's an example, using OFFSET and MATCH, plus an added index column on the Master table. Formulas and discussion below.
Column E uses IF and AND to determine which rows contain the data to be transferred, thn uses MAX to number those rows.
Master::E2: =IF(AND(A>=Report :: $B$5,A<=Report :: $B$6,B=Report :: $B$3,C=Report :: $B$4),MAX($E$1:E1)+1,"")
Fill down to the bottom of column E.
I don't see a need to repeat the "Date" and "Comment" labels on each row containing a date and comment, so I've placed these as fixed text in A8 and B8 of the Report table, and filled the cells below those with the dates and comments using MATCH and OFFSET.
A9: =IF(ROW()>MAX(Master :: $E)+8,"",OFFSET(Master :: $A$1,MATCH(ROW()-8,Master :: $E,0)-1,0))
B9: =IF(ROW()>MAX(Master :: $E)+8,"",OFFSET(Master :: $A$1,MATCH(ROW()-8,Master :: $E,0)-1,3))
As can be seen, these formulas are identical except for the column-offset argument in OFFSET, shown in bold in the examples.
Fill both formulas down to the bottoms of their columns.
Regards,
Barry

Similar Messages

  • SSRS adhoc (2005/2008) - Need to create Report Model (.smdl file) for adhoc using Stored procedure

    Hi All,
    I need to create Report Models using stored procedures. But whenever I am going to create data sources for same, I am just getting tables and views to use. Please see the screenshot below:
    Is there any way out to create data source based on stored procedure? Please help.
    Thanks in Advance
    Regards
    Kumud

    Hi Kumud,
    As per my understanding, it is not support to create a Datasource View (DSV) using stored procedures.
    In a DataSource View, only views, tables or named queries can be used. We can use stored procedures in a query. No parameterized queries, parameterized stored procedures or parameterized UDFs can be used in a DSV named query. You can try to using below approach
    to achieve what you are require:
    To build views in our relational source and add the views to the datasource view to proceed with modelling.
    There is a similar issue, you can refer to it.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22207c21-03c7-4e5a-bb67-0372f29220a3/sql-server-reporting-services-2008-creating-report-models-using-stored-procedures
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Allow users to create reports based on their own selection of fields

    Is there a way to allow users to create reports based on their own selection of fields?
    And if there is a way, then how?
    In access we retrieve all demographic info on one screen and on another screen user can be able to choose specific fields from a list box to import data into file.

    Hi,
    This can be handled in various ways - but the principles are the same.
    You need to apply conditional displays to all of the columns that your user can select and base the display of a column on the value of a field on the page.
    You can have a series of Yes/No options - one for each field and base the display on the corresponding field being Yes. Or you can use checkboxes.
    However, if you wish to use a multiselect list (which is probably easier as you can dynamically generate the list of field names), you will need to have hidden fields that will store either Y/N or 1/0 (I use ones/zeros) and have the conditional displays watch these fields instead. Populating these hidden fields is a bit more tricky than just having fields on the page that the user can control, but is doable:
    1 - Create one hidden field for each field in the report that you want to show/hide. Put these fields in the same region as the select list in a region above the report
    2 - Set conditional display values to "Value of Item in Expression 1 = Expression 2" and use the appropriate hidden field for Expression 1 and in Expression 2 enter in 1
    3 - Create a page process that runs on submit, and create PL/SQL code something like:
    DECLARE
    lFields HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    vField VARCHAR2(1000);
    BEGIN
    :P31_SHOW_EMPNO := 0;
    :P31_SHOW_ENAME := 0;
    :P31_SHOW_JOB := 0;
    :P31_SHOW_MGR := 0;
    :P31_SHOW_HIREDATE := 0;
    :P31_SHOW_SAL := 0;
    :P31_SHOW_COMM := 0;
    :P31_SHOW_DEPTNO := 0;
    lFields := HTMLDB_UTIL.STRING_TO_TABLE(:P31_FIELDS);
    FOR i IN lFields.FIRST..lFields.LAST LOOP
    vField := lFields(i);
    IF vField = 'EMPNO' THEN
    :P31_SHOW_EMPNO := 1;
    ELSIF vField = 'ENAME' THEN
    :P31_SHOW_ENAME := 1;
    ELSIF vField = 'JOB' THEN
    :P31_SHOW_JOB := 1;
    ELSIF vField = 'MGR' THEN
    :P31_SHOW_MGR := 1;
    ELSIF vField = 'HIREDATE' THEN
    :P31_SHOW_HIREDATE := 1;
    ELSIF vField = 'SAL' THEN
    :P31_SHOW_SAL := 1;
    ELSIF vField = 'COMM' THEN
    :P31_SHOW_COMM := 1;
    ELSIF vField = 'DEPTNO' THEN
    :P31_SHOW_DEPTNO := 1;
    END IF;
    END LOOP;
    END;
    4 - Finally, add a button that generates the report - this just needs to submit the page and branch back to the same page
    I've used the standard EMP table for this example and my hidden fields are P31_SHOW_fieldname. The code resets the hidden fields to 0, checks if the user has selected the field from the list (P31_FIELDS) and changes the hidden fields value to 1 for all those selected. When the page is re-rendered, the report hides the columns where the hidden field value is 0 and displays those where it is 1. The export option will then only export those fields that are displayed.
    You can see an example of this here:
    http://htmldb.oracle.com/pls/otn/f?p=33642:31
    Regards
    Andy

  • Creating report based on user selected Date Range

    Hello.
    I am trying to display an Apex report that selects data for the report based on a user entered date range.
    It's a simple page with two date picker fields (p18_start and p18_end).
    The report region SQL looks like this:
    SELECT *
    FROM prj_items
    WHERE LM_DT BETWEEN :p18_start AND :P18_end
    One table, one field on the table to search and two Apex variables.
    I thought this would be fairly simple, but I am obviously missing something.
    I not even sure what other information is needed to help me figure this out.
    -Jody

    Hi,
    You can set defaults for the datepickers if you need to - this could be done in a computation on the page for each item and conditional on the item being null.
    When I've done something similar to this, I've created two hidden page items - eg, :P19_FIRST_DATE and :P19_LAST_DATE and populated these with the earliest/latest date that the user could reasonably select (perhaps, in your case, the MIN(LM_DT) and MAX(LM_DT) values).
    Then your SQL would be:
    select * from PRJ_ITEMS
    where LM_DT BETWEEN TO_DATE(NVL(:P19_START,:P19_FIRST_DATE), 'DD-MON-YY')
    AND TO_DATE(NVL(:P19_END,:P19_LAST_DATE), 'DD-MON-YY')If you don't want to set default dates, you could do something like:
    SELECT * FROM PRJ_ITEMS
    WHERE (:P19_START IS NULL AND :P19_END IS NULL)
    OR (:P19_START IS NOT NULL AND :P19_END IS NULL AND LM_DT >= TO_DATE(:P19_START,'DD-MON-YY'))
    OR (:P19_START IS NULL AND :P19_END IS NOT NULL AND LM_DT <= TO_DATE(:P19_END,'DD-MON-YY'))
    OR (LM_DT BETWEEN TO_DATE(:P19_START,'DD-MON-YY') AND TO_DATE(:P19_END,'DD-MON-YY'))There are various reasons why your two dates are being cleared when the page is reloaded. Firstly, you should check the branch that returns to the same page - make sure you are not clearing the cache for the page. Then, have a look to see if there is a "reset page" process (usually created for you when you create a form page). Then, check the Source settings for the items. Typically, these would be "Only when current value in session state is null" and a Source Type of "Static Assignment" with the "Source Value or Expression" left empty.
    Andy

  • Creating report based on master data

    Hi Guys,
    I want to create a specific report based on master data in BI cube. for example... a report which takes cost center and period as variable and display expenses for that period and cost center. This report I want to create for all cost center in BI database separately. any idea how can we do this?
    There are 2000 cost centers and I need to print/send 2000 reports one for every cost center.
    If I store all cost center in excel file, can it be easier?
    broadcasting and creating 2000 schedule - not option.
    Thanks..SM

    Hi  stuti misra,
    Create ONE Query with selection Cost Center and Period are inputs.
    Create text variables for Cost Center and Period and add in Query Description.
    After query execution you can see description based on selection in workbook or webtemplate.
    Hope it Helps
    Srini
    [Dont forget to close the call by assigning poings.... - Food for Points: Make a Difference through Community Contribution!|https://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/007928c5-c4ef-2a10-d9a3-8109ae621a82]

  • Need to create report query to get latest open and last closed period for given application

    Hi All,
    I need to create a report query to get below result displayed in report output.
    1)   -   Application name
    2)   -    Ledger name
    -o/  -Operating Unit
    3)   -  Last Closed Period
    4)   -  Current Open Period
    5)   -  Date Closed – Last Closed Period
    6)   -  Date Open – Current Open Period
    I tr I tried to create the query below is the same. Please let me know if it looks fine.
    SELECT *
      FROM (SELECT fav.application_name ,
                   hou.name Operating_Unit_Name,
                   gl.name Ledger_name,
                   gl.latest_opened_period_name,
                   gps.period_name Period_Name,
                   DECODE(gps.closing_status, 'O', 'Open', 'C', 'Closed') status,
                   gps.last_update_date Last_status_modified_date
              FROM gl_period_statuses gps,
                   gl_sets_of_books   gsob,
                   fnd_application_vl fav,
                   hr_operating_units hou,
                   gl_ledgers         gl
             WHERE gps.period_name = gps.period_name
               AND gps.closing_status ='C'
               AND fav.application_short_name =
                   NVL('&p_application_short_name', fav.application_short_name)
               AND gps.application_id = fav.application_id
               AND gsob.set_of_books_id = gps.set_of_books_id
               AND hou.set_of_books_id = gps.set_of_books_id
               AND gl.ledger_id = gsob.set_of_books_id
               AND hou.organization_id=NVL('&p_operating_unit',hou.organization_id)
               AND gl.ledger_id=NVL('&p_ledger_id',gl.ledger_id) 
             ORDER BY gps.last_update_date desc )WHERE ROWNUM = 1 
    UNION ALL
    SELECT *
      FROM (SELECT fav.application_name Application_Name,
                   hou.name Operating_Unit_Name,
                   gl.name Ledger_name,
                   gl.latest_opened_period_name,
                   gps.period_name Period_Name,
                   DECODE(gps.closing_status, 'O', 'Open', 'C', 'Closed') status,
                   gps.last_update_date Last_status_modified_date
              FROM gl_period_statuses gps,
                   gl_sets_of_books   gsob,
                   fnd_application_vl fav,
                   hr_operating_units hou,
                   gl_ledgers         gl
             WHERE gps.period_name = gps.period_name
               AND gps.closing_status = 'O'
               AND fav.application_short_name =
                   NVL('&p_application_short_name', fav.application_short_name)
               AND gps.application_id = fav.application_id
               AND gsob.set_of_books_id = gps.set_of_books_id
               AND hou.set_of_books_id = gps.set_of_books_id
               AND gl.ledger_id = gsob.set_of_books_id
               AND hou.organization_id=NVL('&p_operating_unit',hou.organization_id)
               AND gl.ledger_id=NVL('&p_ledger_id',gl.ledger_id) 
             ORDER BY gps.last_update_date desc)
             WHERE ROWNUM = 1

    It is within the table I believe (I'm not a DBA or a developer) since I created a BLOB column and then used the file browse feature to allow users to attach a resume to the table in order to be able to perform a search of the attached documents.
    I'm just having a hard time pointing the link in the search results report to the document in the blob column.
    The information on that page is great if you're trying to create a link to the document on the initial report.
    But I created a query using Oracle Text to run a report that does a boolean search of the attached word documents in the table.
    When it displays the search results, it doesn't create a link to the document and I can't figure out how to do it.
    Here's a link the the instructions I used to create the initial search report with Oracle Text, mind you I only created the index and query, I didn't add in all the link data since they're using documents on websites and I'm using documents in a table.
    http://www.oracle.com/technology/products/database/application_express/pdf/apex_text_application_v1.6.pdf
    If you can help me with this I'd really appreciate it.
    Thanks again.
    Greg
    Edited by: gjones77 on Dec 2, 2008 8:14 AM

  • Create Report based on Query in SCCM 2012

    I have a lot of useful queries, however I would like to create a few reports based on these queries. What is the simple way to do this? I started to create a New Report, but kind of lost after that. Is there a way I can just copy my statement from the
    query to a blank report?

    Execute the WQL query from the queries node in the console and watch smsprov.log on the site server. It should contain the "translated" SQL statement.
    Torsten Meringer | http://www.mssccmfaq.de

  • Table needed to create report showing assigned changes

    Hi there
    I need to create a report that will show me how many CRQ a user currently has assigned to him/herself. Is there a MDG table that can provide me with this info?
    Any hints are highly appreciated!

    If you go to your MDG inbox, you can see all the CR's that are "Created by Me", "To Be Processed by Me", "Processed by Me", and "All." Look at the logic behind this application "My Change Requests" and you should be able to figure out how to extract this data. One thing for sure, you don't need to re-invent the wheel as all the information is available; you just need to format it differently.

  • Create report based on JSON data

    Dear All,
    I'm on Oracle APEX 4.1 and Oracle 11g. I'm receiving JSON data in my application and would like to print report based on JSON data without storing it in any table.
    Can you please suggest best way to achieve it?
    Regards,
    Chintan

    Hi,
    in 4.1 you can for example use the open source PL/JSON library (http://sourceforge.net/projects/pljson/) to parse JSON.
    In APEX 5.0, we currently plan to add a JSON API package that e.g. can be used to convert JSON to XML. Here is an example:
    SQL> select col1, col2
      2  from xmltable (
      3      '/json/row'
      4      passing apex_json.parse('[{"col1": 1, "col2": "hello"},{"col1": 2, "col2": "world"}]')
      5      columns
      6          col1 number path '/row/col1',
      7          col2 varchar2(5) path '/row/col2' );
                    COL1 COL2
                       1 hello
                       2 world
    At the last OOW, it was also announced that the RDBMS will provide native support. That should be the preferred option in the future.
    Regards,
    Christian

  • Need to create at BEX Query to get last 30 days data.

    Hi,
    I need to create a bex query based on input date need to calculate last 30 days outstanding and 31-60 days outstanding 61-90 days outstanding 91-180 days outstanding and greater than 180 days outstanding. Please find the format of the report.Kindly help me.
                                                                                                                          Thanks & Regards,

    Based on those documents you can easily create.
    1. First create variable (Mandatory) user input
    2. Posting date is avaialble as char you will get
    3. need to calcualte difference b/w those 2 dates  you can refer below  By using replacement path we can convert both dates into get difference.
    http://www.sd-solutions.com/SAP-HCM-BW-Replacement-Path-Variables.html
    4. now need to create  Bucketing logic  formula  as per requirement above documents will give idea.

  • Scheduling a report based on Criteria

    Hi guys very new to SSRS, just wondered is it possible to schedule a report to be automatically emailed out subject to criteria.
    For example, I have a report which covers 6 departments (each dept a member of staff who runs it).
    My report runs on a daily basis but may only have activity for 3 departments one day and 1 the next or all the day after. Instead of sending blank reports out, what I'm looking to acheive is send out a report daily ONLY if there is something to send.
    SQL Server 2008 R2 RTM

    Alternatively, create your subscriptions with execution dates in the past. Set them up exactly how you need with the parameters and recipients.
    Once this is completed, you can use SQL Server Agent to schedule a job to check if there will be data in the report, and if there is, call the subscription from the Reporting Server.
    I used this code to find the report(s) I want to call, and have them executed. You will need to replace [REPORTINGSERVICESDB] with name of your SSRS database.
    CREATE PROC [dbo].[SpawnReports] (@reportName VARCHAR(MAX))
    AS
    BEGIN
    DECLARE @eventType VARCHAR(18), @eventData VARCHAR(36)
    DECLARE c1 CURSOR FOR
    SELECT s.eventType, s.eventData
    FROM [REPORTINGSERVICESDB].dbo.Schedule s
    INNER JOIN [REPORTINGSERVICESDB].dbo.ReportSchedule rs
    ON s.ScheduleID = rs.ScheduleID
    INNER JOIN [REPORTINGSERVICESDB].dbo.subscriptions ss
    ON rs.SubscriptionID = ss.SubscriptionID
    INNER JOIN [REPORTINGSERVICESDB].dbo.catalog c
    ON ss.Report_OID = c.ItemID
    WHERE c.Name = @reportName
    OPEN c1
    FETCH c1 INTO @eventType, @eventData
    WHILE @@FETCH_STATUS <> -1
    BEGIN
    EXEC [REPORTINGSERVICESDB].dbo.AddEvent @EventType=@eventType, @EventData=@eventData
    FETCH c1 INTO @eventType, @eventData
    END
    CLOSE c1
    DEALLOCATE c1
    END
    You can then call the report(s) by name:
    EXEC dbo.spawnReports 'Accounting Report'
    Now it's just a case of checking your report has data, and if so, calling the subscription.
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • Suggestion needed on creating report

    Morning all,
    I have been asked to create a report which would categorize each lens type according to month. However each lens type would show number of orders according to number of days.
    For example
                                               Number of days
                                   0 - 1 - 2 - 3 - 4 - 5 -6 - 7 - 8 - 9+
    January
        FSV                  12 - 14 -12 - 45 - 65 ....
        FSV-GL
        RXHC
        RXHC-GL
        RX AR Uncut
        RX AR-GL
    Feburary
        FSV
        FSV-GL
        RXHC
        RXHC-GL
        RX AR Uncut
        RX AR-GL
    March
    Where
    January, feburary are months taken from the dates table, FSV, FSV-GL etc are lens type and 12, 14, 12, 45, 65 are number of orders took for FSV and 0,1,2,3,4... are number of days each order has taken to be shipped.
    Now What I have had a thought in mind is to create a report with First Group being Month, then group each Lens type however not sure how to fit each day and order according to lenstype in that particular month.
    Any ideas how should I create this type of report?
    Regards
    Jehanzeb

    Hmm... do your have the ability (permissions) to create a view in the source database to help simplify this?  Or even use a SQL command for the datasource of the report?  (Actually, what is you underlying datasource?)
    Otherwise I think you may end up with having to create a lot of formulas to init/add to/display variables for each of the 1 - 9+ shipping days columns.
    If going for the latter, yes, group on month/lens type, and in the group header for the lens type have a formula that initializes 9 variables:
    whileprintingrecords;
    numbervar s0:=0; --counter for zero shipping days
    numbervar s1:=0; --counter for 1 shipping day
    numbervar s2:=0; --counter for 2 shipping days
    numbervar s9:=0; --counter for >=9 shipping days
    Then, in the (suppressed) details section; have something that analyzes how days where needed for shipping, and inrcement that appropraite variable:
    whileprintingrecords;
    numbervar shippingdays:= <some logic or field>;
    if shippingdays = 0 then numbervar s0:=s0+1
    else
    if shippingdays = 1 then numbervar s1:=s1+1
    else
    if shippingdays>=9 then numbervar s9:=s9+1
    Finally, in the group footer, create & place ten different formulas, each to display the value in s1 to s9.
    whileprintingrecords;
    numbervar s0;
    whileprintingrecords;
    numbervar s1;
    That should probably do you...

  • Need help creating report

    hi guys, I am creating an employee report details. the report should contain all details, id, name, email,...., and photo.
    how to do this?
    it is easy to put logo because it is static but how to display dynamic picture?

    We create an image directory on the server with a sub folder for the images
    <xa href="javascript:popUpImage('#Image Dir##Image#','#ID#')"> <img SRC="#Image Dir##Image#" HEIGHT=50 WIDTH=50 ALT="#Staff Name#" /img> </a>'
    (ignore the x in the <xa
    this is the code within the report (column formating) we use to pull back the image
    in the report atribute select we use
    nvl(image_file_name,'&NO_IMAGE_FILE.') "Image",
    nvl(image_file_directory,'&IMAGE_FILE_DIRECTORY') "Image Dir"
    hope this is of help
    Message was edited by:
    bjorn toulouse
    Message was edited by:
    bjorn toulouse
    Message was edited by:
    bjorn toulouse

  • Create report based on last generated report

    I want to build a report, generated automatically in crystal server 2008, based on the last generated report. Can you help ?

    Not possible, reports must exist

  • Need help creating text based game in Java

    Alright, I'm taking a big leap and I'm jumping a little out of league here. Anyways here are my two classes...I'm sure I've got plenty of errors :-/ One other thing. I have only programmed the battle section of the program so don't worry about the other 5 sections when fixing the code.
    import cs1.Keyboard;
    public class Knights
        public static void main (String[] args)
            // Object Declaration
            KnightsAccount player1 = new Account (1, 100, 200);
            // variable declarations
            boolean run = true;
            int choice;
            // Game Start
            System.out.println ("Welcome to Knights.");
            System.out.println ("--------------------------------------");
            System.out.println ("You are a level 1 character.  With 100 HP and 200 gold...good luck.");
            System.out.println ();
            while (run == true)
                System.out.println ();
                System.out.println ("Enter the number of the option you would like to do");
                System.out.println ();
                System.out.println ("1. Battle");
                System.out.println ("2. Train");
                System.out.println ("3. Work");
                System.out.println ("4. Rest");
                System.out.println ("5. Stats");
                System.out.println ("6. Quit");
                choice = Keyboard.readInt();
                if (choice == 1)
                    player1.battle();
                else if (choice == 2)
                    player1.train();
                else if (choice == 3)
                    player1.work();
                else if (choice == 4)
                    player1.rest();
                else if (choice == 5)
                    player1.stats();
                else
                    run = false;
    }And here is the second class...
    import java.util.Random;
    public class KnightsAccount
        public String winner;
        public int exp = 0;
        public void Account (int level, int hitPoints, int gold) {}
        public battle ()
            Random generator = new Random();
            int pumpkinHP = 80;
            int playerAttack, pumpkinAttack;
            System.out.println ("Engaged in combat with an Evil Pumpkin!");
            while (hitPoints > 0 && pumpkinHP > 0)
                if (pumpkinHP > 0)
                    playerAttack = generator.nextInt(15);
                    hitPoints -= playerAttack;
                    System.out.println ("Player 1 attacked Evil Pumpkin for " + playerAttack + ".");
                    System.out.println ("Evil Pumpkin has " + hitPoints + " HP left.");
                if (pumpkinHP <= 0)
                    pumpkinDead();
                if (hitPoints > 0 && !(pumpkinHP <= 0))
                    pumpkinAttack = generator.nextInt(12);
                    hitPoints -= pumpkinAttack;
                    System.out.println ("Evil Pumpkin attacked Player1 for " + pumpkinAttack + ".");
                    System.out.println ("Player 1 has " + pumpkinHP + " HP left.");
                if (hitPoints <= 0)
                    playerDead();
            return winner;
        private pumpkinDead ()
            System.out.println ("Success!  You have defeated the Evil Pumpkin with " + hitPoints + "HP left!");
            System.out.println ("For you good deed you earned 20 exp.");
            exp += 20;
            return exp;
        private void playersDead ()
            System.out.println ("You have been defeated.  Go home before we pelt melty cheeze at you.");
    }Whoever can help me I'd be grateful. I know there are probably a lot of things wrong here. Also if some of you could post your AIM or MSN so that I can get some one on one help on any of the smaller problems I run acrost that would help a lot too.
    Duke dollars to whoever helps me ;)
    AIM: Trebor DoD
    MSN: [email protected]

    You should really create a GameCharacter object that contains the
    statistics for a character (player or non-player) in the game.
    public class GameCharacter {
       private double attackStrength;
       private double defenseStrength;
       private String name;
       private String[] bodyParts;
       private Random = new Random();
    public GameCharacter(String name, String[] bodyParts, double attackSt, double defenseSt){
       this.attackStrength = attackSt;
       this.defenseStrength = defenseSt;
       this.bodyParts = bodyParts;
       this.name = name;
    // put lots of methods in here to get and set the information
    public String getName(){
      return this.name;
    public String getRandomBodyPart(){
       return this.bodyParts[random.nextInt(this.bodyParts.length)];
    }You then create your "knight" character and your "rabid pumpkin"
    character.
    Your fight method then just takes two GameCharacter objects and uses
    the information they contain to fight the battle.
    public void fight(GameCharacter a, GameCharacter b) {
       boolean fightOver = false;
       Random rn = new Random();
       double attackValue;
       while(!fightOver) {
           attackValue = a.getAttackStrength()*rn.nextDouble();
           System.out.println(a.getName()+" attacks "+b.getName()+"'s "+b.getRandomBodyPart()+" for "+attackValue+" points");
    }The above is not the fighting loop of course. I just put it in to
    demostrate how the fight method can be made generic. It takes any
    two characters and uses their defensive and attack information to
    calculate the fight outcome. It also uses the descriptions that the characters have
    to make the fight more interesting. (the getRandomBodyPart method in
    particular)
    matfud

Maybe you are looking for