Help me to build the logic

Hi experts,
i want to build the logic as follows.
the give fields in the ITAB are.
F1    F2 F3
123  546
222  788
222  277
222  666
345  431
345  888
777  888
F1 AND F2 are the given fields i want to out put f3 as follow.
F1    F2  F3
123  546  10
222  788  10
222  277  20 
222  666  30
345  431  10
345  888  20
345  888  20
if f1 abd f2 repeats the f3 will be same number.
if f1 repeats and f2 is diff then sequence will be incremented every time by 10.
when f1 starts with diff number then f3 starts with number 10 as above shown.
Please build me the logic by using Internal table.
Please help me

Hi Ramesh,
Please see the following test program..
<b>REPORT ZSRITEST44 .
DATA: BEGIN OF gt_data OCCURS 0,
        f1 TYPE i,
        f2 TYPE i,
        f3 TYPE i,
      END OF gt_data,
      BEGIN OF gt_datac OCCURS 0,
        f1(10),
        f2(10),
        f3 TYPE i,
      END OF gt_datac,
      gv_counter TYPE i.
gt_data-f1 = 123.
gt_data-f2 = 546.
APPEND gt_data.
gt_data-f1 = 222.
gt_data-f2 = 546.
APPEND gt_data.
gt_data-f1 = 222.
gt_data-f2 = 277.
APPEND gt_data.
gt_data-f1 = 222.
gt_data-f2 = 666.
APPEND gt_data.
gt_data-f1 = 345.
gt_data-f2 = 431.
APPEND gt_data.
gt_data-f1 = 345.
gt_data-f2 = 888.
APPEND gt_data.
gt_data-f1 = 345.
gt_data-f2 = 888.
APPEND gt_data.
gt_data-f1 = 777.
gt_data-f2 = 888.
APPEND gt_data.
SORT gt_data BY f1 f2.
LOOP AT gt_data.
  AT NEW f2.
    ADD 10 TO gv_counter.
  ENDAT.
  AT NEW f1.
    CLEAR gv_counter.
  ENDAT.
  IF gt_datac-f1 EQ gt_data-f1
  AND gt_datac-f2 EQ gt_data-f2.
    IF gv_counter GT 0.
      gv_counter = -1 * gv_counter.
    ENDIF.
  ENDIF.
  gt_datac-f1 = gt_data-f1.
  gt_datac-f2 = gt_data-f2.
  gt_datac-f3 = gv_counter + 10.
  COLLECT gt_datac.
  IF gv_counter LT 0.
    CLEAR gv_counter.
  ENDIF.
ENDLOOP.
LOOP AT gt_datac.
  gt_data-f3 = gt_datac-f3.
  MODIFY gt_data TRANSPORTING f3
  WHERE f1 = gt_datac-f1 AND f2 = gt_datac-f2.
ENDLOOP.
LOOP AT gt_data.
  WRITE: / gt_data-f1, sy-vline, gt_data-f2, sy-vline, gt_data-f3.
ENDLOOP.</b>
Hope this helps..
Sri

Similar Messages

  • Please help me to build the logic

    Hi All,
    Please help me to implement the following logic.
    The conditional statements should not only be executed in sequence, but also if any of them are true they should not be overridden by any subsequent conditional statements being true.
    When actual effort Accepted or Rejected for AST proposals and calculate a flag for “enhance to AST guideline” = Y/N as follows for each employee and display at the employee level
    1)If AST eligibility = N AND proposed AST % >0, then “N”
    2)Else If AST eligibility = N AND proposed AST % = 0 then “n/a”
    3)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST = 0 then “Y”
    4)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST >0 then “N”
    5)Else If AST eligibility = Y AND Act Rank = 2 AND proposed AST = 0 then “Y”
    6)Else If AST eligibility = Y AND AST % is greater than or equal to the AST guideline minimum AND less than or equal to the AST guideline maximum, then “Y”
    7)Else If AST eligibility = Y AND AST % is less than the minimum guideline OR greater than the maximum guideline, then “N”
    I tried the following code but I am not getting the expected result .
    Could you Please help me to build the logic.
    Your earliest response is very helpful to me.
    if (upper(P_stat)='ACCEPTED' or upper(P_stat) like 'REJECTED%') then
    else if NVL(P_elgi,'N') <> 'Y' AND P_prop > '0' then
    P_flag := 'N';
    else if(NVL(P_elgi,'N') <> 'Y' AND P_prop = '0') then
    P_flag := 'N/A';
    else if ((NVL(P_elgi,'N')='Y') AND P_rank = '3' AND P_prop = '0') then
    P_flag := 'Y';
    else if((NVL(P_elgi,'N')='Y') AND P_rank = '3' AND P_prop > '0') then
    P_flag := 'N';
    else if((NVL(P_elgi,'N')='Y') AND P_rank = '2' AND P_prop = '0') then
    P_flag := 'Y';
    Else if (P_prop >=ast_min_guide AND P_prop <= ast_max_guide ) then
    P_flag := 'Y';
    else
    ((P_prop < ast_min_guide) OR (P_prop > ast_max_guide)) then
    P_flag := 'N';
    end if;
    end if;

    Thanks for ur quick responce .
    When actual effort Accepted or Rejected for AST proposals and calculate a flag for “enhance to AST guideline” = Y/N
    Once the above condition is satisfied we have to check for remaing conditions
    if (upper(P_stat)='ACCEPTED' or upper(P_stat) like 'REJECTED%') then
    once it is satisfies then we have to go for remaing conditions.
    how can we do it in CASE statement.
    1)If AST eligibility = N AND proposed AST % >0, then “N”
    2)Else If AST eligibility = N AND proposed AST % = 0 then “n/a”
    3)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST = 0 then “Y”
    4)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST >0 then “N”
    5)Else If AST eligibility = Y AND Act Rank = 2 AND proposed AST = 0 then “Y”
    6)Else If AST eligibility = Y AND AST % is greater than or equal to the AST guideline minimum AND less than or equal to the AST guideline maximum, then “Y”
    7)Else If AST eligibility = Y AND AST % is less than the minimum guideline OR greater than the maximum guideline, then “N”
    I tried the following code but I am not getting the expected result .

  • How to build the Logical cube and physical cube

    Hi All,
    I have to build the logical cube and physical cube ,i dont have idea about this ,that means i think for that we have to do the partition for the cube
    may i correct , correct me if i wrong ,plz help me on this
    Thanks

    Hi,
    1. Firsty, logical model and physical model are the terms ,which we generally use in the context of database modelling excercise.
    2. Coming to essbase, I am not sure ,what exactly you are trying to co relate . but as you termed 'partitions'. There is one of the types in partitioning called 'Transparent Partition'. Where, you have one cube ( which has data in it) and you can have one mroe cube ( which actually has no data in it). But it can be connected to the former cube with the help of transparent partition. This way, you have 2 cubes , but only one cube has data in it.
    Sandeep Reddy Enti
    HCC
    http://hyperionconsultancy.com/

  • How and where I can build the logic to calculate between cal days?

    Hi
    I have the cube having data like below. When I run the report based on calendar day as input, I would like to get output data how many Line Items based on my selection (status, Trans status) from between calendar day to calendar day+150 days.
    0Calday     Sold-to-Party           Status                 Trans No     Trans Status      Line Items
    03.10.2008     2000028074     50     216270          28                       1
    05.11.2008     2000024917     40     216281          15                       1
    06.10.2008     2000006277     33     216292          28                       1
    15.12.2008     2000019927     33     216303          10                       1
    If I provided calendar day as input at query how and where I can build the logic u201Cbetween calendar days to calendar day+150 daysu201D?
    For example, If I run a report as caleder input  03.10.2008 with selections status = 40,33, Trans statu =15,10, with above data, I can get the output below.
    05.11.2008     2000024917     40     216281          15                       1
    15.12.2008     2000019927     33     216303          10                       1
    Please help me to build the above logic?
    Thanks,
    Mannev

    Hello,
    There are some informtion in SDN that can be useful regarding customer exit for variables in BEX, for example:
    need clarification on BEX variable usage in customer exit.
    you can also try to use the variable offset:
    variable offset in Bex
    Best Regards,
    Ricardo

  • Guys! help me iin finding the logic

    can any one help me in finding
    1. inactive  customer
      1.1  - who did not have transaction for past 15day fianancial dept
      1.2 - who did not have transaction for past 15 days with sales dept
    2. inactive vendors
    2.1 - who did not have any transaction for past 15 days with finance dept
    2.2 - who did not have transactions for past 15 days with material dept.
    help me please asap.

    Hi,
    Inactive customers:
    Use tables kna1, knb1, knkk, vbrk(past activity).
    next activity - fplt, fpla, vbpa.
    1. 1st get the payers from KNB1 based on selection screen on payer and company code.
    2. KNKK logic
      select single kkber from t001 into v_kkber
                                   where bukrs eq p_bukrs.
        select kunnr kkber knkli nxtrv from knkk into table knkk_it
               for all entries in knb1_it where kunnr = knb1_it-kunnr and
                                                kkber = v_kkber and
                                                sbgrp in s_sbgrp.
    3.Last activity
        select vkorg erdat kunrg from vbrk into table vbrk_it
                           where vkorg = v_vkorg and
                                 erdat in before_dt.
        sort vbrk_it by kunrg.
    4. Next activity
    select single vkorg from tvko into v_vkorg where bukrs = p_bukrs.
      if not v_vkorg is initial.
        select fplnr fpltr fkdat from fplt into table fplt_it
                                                where fksaf = space and
                                                      fkdat in after_dt.
        sort fplt_it by fplnr fpltr.
        if not fplt_it[] is initial.
          select fplnr vbeln from fpla into table fpla_it
                 for all entries in fplt_it where fplnr = fplt_it-fplnr.
        endif.
        sort fpla_it by fplnr vbeln.
        if not fpla_it[] is initial.
          select vbeln kunnr from vbpa into table vbpa_it for all entries in
                                  fpla_it where vbeln = fpla_it-vbeln and
                                                posnr = '000000' and
                                                parvw = 'RG'.
        endif.
        sort vbpa_it by kunnr.
      endif.
    Later process all into final internal table.
    If this helps you award points.
    Thanks,
    Deepak.
    Message was edited by:
            KDeepak

  • Help needed in formulating the logic!!

    Hi experts,
    I have a requirement something like this. In CFM module we have some deals created.
    For each deal there will be deal start date and end date.
    Based on the user given input date I need to capture intrest accumlated till that date. Thats ok. But the problem is in between there can be repayments done.
    For example : say deal number is 2004010155
    start date : 4/1/2008
    end date : 3/31/2009
    basic amount : 8,00,000.
    say suppose  on 30.06.2008 a partial repayment of 1,00,000 done.
    Now if user given date is 31.07.2008,then we need to calculate intrest amount with basic amount as 8,00,000 till 30.06.2008 and
    starting from 01.07.2008 to 31.07.2008(user given date) I need to calculate intrest with amount 7,00,000.(After deducting one lakh as partial repayment done during this period).
    For refernce table name is VTBFHAPO.
    How can we achieve this?
    Thanks & Regards
    Himayat.

    Hi,
    Currently this how am trying to do. Partial repayment not taken into consideration yet. Its for calcualting intrest amt based on linear method or exponential method.
    READ TABLE i_vtbfhazu.
              IF sy-subrc = 0.
                i_final-dblfz = i_vtbfhazu-dblfz.
                i_final-delfz = i_vtbfhazu-delfz.
              ENDIF.
              IF p_datum = i_final-delfz.
                i_final-int_per = ( p_datum - i_final-dblfz ) .
              ELSEIF  p_datum < i_final-delfz.
                i_final-int_per = ( p_datum - i_final-dblfz ) + 1.
              ELSEIF p_datum > i_final-delfz.
                i_final-int_per = ( i_final-delfz - i_final-dblfz ) + 1.
              ENDIF.
              READ TABLE ivtbfhapo1 WITH KEY rfha = i_vtbfhazu-rfha
                                          rfhazu = '1'
                                          rfhazb = '1' BINARY SEARCH.
              IF sy-subrc = 0.
                g_bzbetr = ivtbfhapo1-bzbetr.
                i_final-bzbetr = g_bzbetr.
              ENDIF.
              READ TABLE ivtbfhapo WITH KEY rfha = i_vtbfhazu-rfha
    *                              szbmeth = '3'
                                    rkond   = '1000' BINARY SEARCH.
              IF sy-subrc = 0.
                i_final-pkond = ivtbfhapo-pkond.
                CLEAR : g_int_amt, g_wtd_prn.
                READ TABLE ivtbfhapo2 WITH KEY rfha = i_vtbfhazu-rfha
                                               jexpozins = 'X' .
                IF sy-subrc = 0 .
                  CASE ivtbfhapo2-ammrhyzv.
                    WHEN '00'. g_var = 1.
                    WHEN '06'. g_var = 2.
                    WHEN '03'. g_var = 4.
                    WHEN '01'. g_var = 12.
                    WHEN '52'. g_var = 52.
                    WHEN OTHERS. g_var = 1.
                  ENDCASE.
                  g_int_amt =  i_final-bzbetr * ( 1 +  i_final-pkond  /
                     ( g_var * 100 ) )  ** ( i_final-int_per * ( g_var  /
                        ivtbfhapo2-abastage ) ).
                  g_int_amt = g_int_amt - i_final-bzbetr.
                  i_final-int_amt = g_int_amt.
                ELSE.
                  LOOP AT ivtbfhapo2 WHERE rfha = i_vtbfhazu-rfha
                                      AND abastage > '000000'.
                    g_int_amt = i_final-bzbetr * ( i_final-pkond / 100 ) * (
                           i_final-int_per / ivtbfhapo2-abastage ).
                    i_final-int_amt = g_int_amt.
                  ENDLOOP.
                ENDIF.
                g_wtd_prn = i_final-bzbetr * i_final-int_per.
                i_final-wtd_prn = g_wtd_prn.
                APPEND i_final.
    Thanks & Regards
    Himayat

  • Getting the logical system from where RFC is being called

    Hi All,
    How can we get the logical system name from where RFC is being called?
    Regards,
    Akshay

    Hi Akshay,
    If your company follows the SAP recommendations on naming [logical systems|http://help.sap.com/SAPHELP_NW70/helpdata/EN/da/5990df015b5b43a36f6ce7fa1ee8c0/content.htm] <b>&lt;SystemID&gt;"CLNT"&lt;Client&gt;</b> then you should get away with a simple call to RFC_GET_ATTRIBUTES (and even if they don't, the function module might possibly provide other clues required to build the logical system name).
    There might be other ways, but I'm kind of suspecting that the logical system name of the calling system might not be part of the communication data (like other readily available data as IP address etc.). So if this solution doesn't work, it might be helpful to understand how the naming conventions for logical systems used by your company.
    Cheers, harald

  • Need help in correlated sub query logic

    Hi ,
    I have one procedure with cursor. I have given small part of the cursor as shown below .
    SELECT
      A.DAY_DATE,
      A.COUNTRY_CODE,
      A.INST_CODE,
      a.bra_code,
      a.cus_num,
      a.cur_code,
      a.led_code,
      a.sub_acct_code,
      (tra_amt * SPOT_RATE) pre_day_crnt_bal,
      t.mat_date,
      t.NEW_INT_RATE int_rate,
      t.DEB_CRE_IND int_chg_pai_ind,
      a.ACCT_TYPE,
      (SELECT COUNT (
      DISTINCT TO_CHAR (day_date, 'mm')
      FROM PIO_TIMES
      WHERE day_date BETWEEN a.day_date
      AND NVL ( T.MAT_DATE,A.DAY_DATE) 
      AND TO_CHAR (day_date, 'dd') = '31') Test
    Here how can I build the logic for inside select statement.
    I tried to build the separate stream for the inside select statement but I am confusing how to handle the count in the inside the query.
    Please help me how to build the logic for the inside query statement .
    Thanks & Regards,
    Ramana.

    Hi Balakrishna,
    Thanks for your support
    I have applied but I am not getting the column in the output columns from the custom sql function.
    As per the procedure we are using the all conditions like between and month or date conditions  to find the count of distinct months.
    If we use partial conditional in the custom SQL  and partial conditionals in the lookup condition clause is it give the same result?
    How can we get the field of custom sql in the output field.
    Thanks & Regards,
    Ramana.

  • How 2 Set the logic for report 2 run 1st of everymonth......

    Hi Experts,
    i ve developd a HR-ABAP report in that Some part of code will Mon-Fri, Excluding Public holidays and sat & sundays...( i.e no public holidays and no sat & sundays)
       and some part of should Run on 1st of everymonth.... but 2 parts of code should be in same report..
    How can set the logic to run the report respective times....
    Thanks in Advance....
    sudeer.

    you can code this but need some good expertise on fm's  , date handling techniques and subroutine call coding.
    1.
    to make the code run only on 1st of every month
    capture the rundate of ur prog .. take value of  sy-datum
    ex.. 01.xx.yyyy
    or date std will be yyyymmdd so check for dd = 01 ..
    so per logic first two chars show that its first of any month in any year ..
    if yes
    execute the logic for the first of every month ..
    endif.
    2.
    where the code needs to be run on mon-fri and not on public holidays / sun / sat ..
    first fetch the day based on date .. like mon or tue or wed .. except sat and sun..
    second check whether if m-t-w-th-fr if any of them is  a holiday or not
    u need to check the date in the calender list like tholi thoc and .. to check whether that is a holiday or not ..
    coming to sat and sundays .. u need to check the day for date using function modules and build the logic ...
    br,
    vijay..

  • PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED"

    HAI EVERYBODY,
    PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED" during the material master replication by using middleware parameters.
    step1 : i have taken SRM client 810 and named it as CHINNISRM
    step2 : i  have taken r3 client 810 and named it as CHINNIR3
    step3: During material master replication i maintained tables like crmconsum,crmrfcpar,crmparoltp in   r3   and smofparsfa in srm client and filtered the objects and loaded the objects through r3ac3,r3ac1,r3as.
    step4 : And later i have checked in r3 queues to activate the objects,but i have seen a message like  "LOGICAL SYSTEM CHANGED:SEE 588701".according to the oss instructions i have checked in CRMPRLS table in se16 in R3 .there i found out there is one logical client  named with T90CLNT810.
    oss :588701
    Solution
    There are different cases in which different forms of processing are
    required or where several options exist:
    - The logical system name of an R/3 Backend client was changed in
    current operation. In this case, the data hangs in the outbound
    queues of the R/3 Backend system as specified under point 1 of
    the symptom. In this case, the logical system name must be
    changed back to the original value. Then the outbound queues
    can be reactivated. If no data was transferred to the EBP/CRM
    server before the change, also a correctioin of the check table
    is possible.
    - The same logical system name was used again in a new client of
    an R/3 Backend system that was linked to the EBP/CRM server. In
    this case, the data is in the inbound queue of the EBP/CRM
    server with the exception GUID_FOR_LOGSYS_CHANGED. In this
    case, the queue entries which have status SYSFAIL must be rejected, however, not the entire queues. If the new client of  the R/3 Backend system you have linked has exactly the same
    data as the old client and if it is meant to replace the old
    client (that is, this was deactivated), also a correction of
    the check tables is possible. In this case, the inbound queues
    can be reactivated after the correction.
    oss:765018
    1. If the situation in your system corresponds to the situation described
    under "Reason and Prerequisites" and if symptom 1 occurs, you can
    delete the table entry from table CRMPRLS table (there is just one
    entry). Since there is no maintenance dialog for this table and you
    cannot maintain it using transaction SE16, you must use a report to
    delete it. This report is attached to this note as correction
    instructions.
    Create the report ZZ_DELETE_CRMPRLS in your system and copy the source
    code from the correction instructions. You cannot implement this
    source code using transaction SNOTE.
    You can use the report in every plug-in or plug-in basis system, even
    if it is not specified in the validity section.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1.
    2. If the situation in your system corresponds to the situation described
    under "Reason and prerequisite" and if symptom 2 occurs, you can
    delete the entry from table CRMMLSGUID (there is just one entry).
    Since there is no maintenance entry for this table and you cannot
    maintain it using transaction SE16, you must use a report to delete
    it. This report is attached to this note as correction instructions.
    If they do not yet exist, add the following messages to message class SMOF in your logon language:
    Message Message short text
    303 User &1 is not allowed to change table &2.
    304 User &1 IS not allowed to display table &2.
    305 Logical system &1 was not found in table &2.
    306 System error! The current client was not
    found in table T000.
    Create the report ZZ_DELETE_CRMMLSGUID in your system and copy the
    source code from the correction instructions. You cannot implement
    this source code using transaction SNOTE.
    You can use the report for every release of the CRM system, even if it
    is not specified in the validity section. The only exceptions are CRM
    releases with Support Package versions that are too low such as CRM
    Release 3.0 with Support Package 12.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1 of the R/3 back-end system or transaction SMQ2 of
    the CRM system.
    so what should i do to do the replication.please suggest me .untill and unless i solve my problem i cant move to the further activity.i hope you people can solve my problem.thanks in advance.
    thanks and best regards,
    n.chakradhar

    Hi chakradhar,
    Did you find a solution to your issue? We are facing a similar issue and looking to figure out how this can be resolved.
    BR// 420

  • Help needed on the logic used to display ERP Sales order in CRM WEB UI

    Hi,
    I have a requirement where i need to trigger an activity/workflow in CRM for orders that are created through ERP Salesorder functionality. In the workflow list, we need to give the order description and provide an hyperlink to the order number. on selection of order number, it should display the ERP sales order. To achive this in workflow, i am trying to understand the as-is standard functionality which is available in Agent Inbox search on ERP sales order.This search is getting the ERP orders and on selecting the order it is opening the ERO sales order page. I tried debugging the method GET_MAINCATAEGORY available in the component iccmp_inbox and in the view Inboxsearch.But couldnt really able to crack the logic how it is retrieving the ERP sales order from inbox search. Any pointers on how this is achieved will be of great help.
    Thanks,
    Udaya

    Hi Denis,
    very good idea. I thougt myself about that workaround, but it is not really that for what I searched.
    I mean the "SAP Query" is a really good standard tool, that are used by many customers. That is why think there must be a standard way to display the SAP Query in the Web UI without using Transaction Launcher.
    But it seems that there is no way, except of the transaction launcher or by using an additional analyse system like SAP BI.
    By the way do you know a Web UI compoment which enable the user to start reports like SE38?
    Regards
    Fabian

  • I need help with event structure. I am trying to feed the index of the array, the index can vary from 0 to 7. Based on the logic ouput of a comparison, the index buffer should increment ?

    I need help with event structure.
    I am trying to feed the index of the array, the index number can vary from 0 to 7.
    Based on the logic ouput of a comparison, the index buffer should increment
    or decrement every time the output of comparsion changes(event change). I guess I need to use event structure?
    (My event code doesn't execute when there is an  event at its input /comparator changes its boolean state.
    Anyone coded on similar lines? Any ideas appreciated.
    Thanks in advance!

    You don't need an Event Structure, a simple State Machine would be more appropriate.
    There are many examples of State Machines within this forum.
    RayR

  • I purchased CS6 2 years ago (or more) I now keep being asked to register, I also find Bridge is running slow in building the cache is this two problems or are they interrelated  - any help please.

    Hello could anyone advise me please:
    I purchased CS6 Student edition approx 2 years ago, and I have been using it pretty much on a daily basis.  Now it has suddenly started prompting me to register the software because the trial has ended. I did think about uninstalling and reinstalling but thought against this in view of the fact that CS6 is no longer available for purchase.
    I am also having problems with the speed of Bridge in building the cache it seems to take for ever - about 2 sec per image.
    Any help would be much appreciated.

    Sign in, activation, or connection errors | CC, CS6, CS5.5
    And for the Bridge cache simply flush it from the Bridge prefs and rebuild it - after doing disk maintenance liek defragmenting your drives.
    Mylenium

  • The logic is done, but my LAYOUT looks Awful!!! help?

    You guys have been great in helping me get through my little trivia game project and I believe I have ALL the logical processing in place, but the final and saddest MOST BLARING problem now is this DISGUSTING Layout.
    Here is the link:
    http://www.flickr.com/photos/7270990@N06/414222370/
    (PLEASE DONT LAUGH TOO HARD) -- I have been saving this part till last.
    BUT do you guys have any easy layout suggestions? I looked around for awhile and all the layouts seem very complicated to get the look I would like. I just want to be able to have more control and make it look better. I thought of the border layout but couldnt get more than one element in each section.
    I would like the top10 list to be straight down -- more space and even alignment between the buttons and questions....blah blah blah.
    I'm sure some of you have heard this 1000 times... can you give me some hints?
    Message was edited by:
    tvance929

    Thanks all! I just read your posts... I'm putting the first part of my code but PLEASE realize, this is my first big (for me) program -- I'm a newbie, I know it is a little scattered and probably not commented like it should be... so grace and mercy would be appreciated, but so would some coding advice! NOT TOO MENTION my layout issue problem.
    =======================
    import java.text.*; //for formatting
    import javax.swing.*; //imports swing classes
    import java.awt.event.*; //imports event listeners
    import java.awt.Container; // Container methods
    import java.awt.*; //layout manager
    import java.io.*; // File readers
    import java.util.*; // Tokenizer
    import java.util.Arrays;
    public class TriviaGame extends JFrame {
    private JFrame mainFrame; //main container variable
    private JButton answerButton; // Calculate button variable -
    private JButton exitButton; // Exit button variable
    private JTextField answerField; // Length text field variable
    private JTextField scoreField; // Score field variable
    private JTextField qmissedField; // Questions missed field
    private JLabel[] toptenLabel; // Top Ten Labels (array so we can print them all as seperate labels)
    private JLabel questionLabel; // The Questions label
    private JLabel qmissedLabel; //Questions Missed label
    private JLabel scoreLabel; //Score label
    private JLabel answerLabel;
    private JLabel totalPointLabel, answerReport;
    private JLabel TopTenScores, top1, top2, top3, top4, top5, top6, top7, top8, top9, top10; //Top Ten Scores Labels
    private String questionsFile = "questions.txt";
    private String toptenFile = "topten.txt";
    private String inLine, newScore, playerName;
    private StringTokenizer st;
    private int i, e, score, questionsMissed, randomQuestion;
    private int[] qpointsInt, topScoresInt;
    private double random;
    private String[] answer, fileCustomer, question, qpoints, questionAsked, topScores, topNames, topTenScores;
    /** Creates a new instance of TriviaGame */
    public TriviaGame() {
    mainFrame = new JFrame("Todd's Trivia"); //Defining container with label
    //Buttons on interface
    answerButton = new JButton("Submit"); //Creating Calc button
    exitButton = new JButton("Exit"); // Creating Exit Button
    qmissedLabel = new JLabel("Questions Missed:"); //Creating width label
    scoreLabel = new JLabel("Score:"); //depth label
    answerLabel = new JLabel("Answer");
    answerReport = new JLabel("");
    TopTenScores = new JLabel("TOP TEN SCORES!");
    //text fields for labels
    answerField = new JTextField(5);
    scoreField = new JTextField(5);
    qmissedField = new JTextField(5);
    //These strings are for the data that will be read in from the external file (customers.txt)
    question = new String[10];
    answer = new String[10];
    qpoints = new String[10];
    qpointsInt = new int[10];
    questionAsked = new String[10];
    topScoresInt = new int[10]; //Int'ing the top ten scores from the file
    topScores = new String[10];
    topNames = new String[10];
    topTenScores = new String[10]; //Concatenated scores and names for using Array.sort() if it will work!
    HighScore[] top = new HighScore[10]; //High Score object that will properly sort the scores
    questionsMissed = 0; //Questions Missed variable...duh!
    //Assign ALL questions asked with the marker of "n" for NO - this variable will tell us if a question has been asked yet or not.
    // Need to change this iteration as we add more questions!!!
    for (e=0; e<10; e++)
    questionAsked[e] = "n";
    i = 0; //The line counter for reading from file
    score = 0; //Score!
    //TOP TEN SCORES MECHANISM - implementing the HighScore object!
    try //the reader stream must have a means for throwing errors if problem with opening stream
    BufferedReader br = new BufferedReader (new FileReader(toptenFile)); //Opens stream to read data from file
    //The following few lines pull the data from the file line by line and create a seperate variable for each piece of data
    while ((inLine = br.readLine())!= null)
    st = new StringTokenizer (inLine);
    topScores[i] = st.nextToken();
    topNames[i] = st.nextToken();
    topScoresInt=Integer.parseInt(topScores[i]);
    top[i] = new HighScore(topScoresInt[i],topNames[i]);
    i++;
    br.close(); //closing the stream
    Arrays.sort(top);
    i = 0; //Resetting this variable for the next read.
    catch(IOException e) //Catches an IOExceptions and gives appropriate response.
    JOptionPane.showMessageDialog(null, "Top Ten File NOT FOUND - exiting program", "File Not Found!",
    JOptionPane.INFORMATION_MESSAGE);
    top1 = new JLabel("1. " + top[9]);
    top2 = new JLabel("2. " + top[8]);
    top3 = new JLabel("3. " + top[7]);
    top4 = new JLabel("4. " + top[6]);
    top5 = new JLabel("5. " + top[5]);
    top6 = new JLabel("6. " + top[4]);
    top7 = new JLabel("7. " + top[3]);
    top8 = new JLabel("4. " + top[2]);
    top9 = new JLabel("5. " + top[1]);
    top10 = new JLabel("6. " + top[0]);
    try //the reader stream must have a means for throwing errors if problem with opening stream
    BufferedReader br = new BufferedReader (new FileReader(questionsFile)); //Opens stream to read data from file
    //The following few lines pull the data from the file line by line and create a seperate variable for each piece of data
    random = Math.round(Math.random()*4);
    randomQuestion = (int)random;
    while ((inLine = br.readLine())!= null)
    if (i == randomQuestion)
    st = new StringTokenizer (inLine, "^");
    question[i] = st.nextToken();
    answer[i] = st.nextToken();
    qpoints[i] = st.nextToken();
    qpointsInt[i]=Integer.parseInt(qpoints[i]);
    questionLabel = new JLabel(question[i]); //This creates a SINGLE question that has been chose randomly
    totalPointLabel = new JLabel(qpoints[i]); //This is to tell us what question it is.
    questionAsked[i]="y";
    break;
    i++;
    br.close(); //closing the stream
    catch(IOException e) //Catches an IOExceptions and gives appropriate response.
    JOptionPane.showMessageDialog(null, "Question File NOT FOUND - exiting program", "File Not Found!",
    JOptionPane.INFORMATION_MESSAGE);
    Container c = mainFrame.getContentPane(); // Get the content pane
    c.setLayout(new FlowLayout(FlowLayout.CENTER)); // Setting Layout
    //adding all components to layout in order of appearence
    c.add(questionLabel);
    c.add(answerField);
    c.add(answerLabel);
    c.add(answerButton);
    c.add(scoreField);
    scoreField.setText("0");
    c.add(scoreLabel);
    c.add(qmissedLabel);
    c.add(qmissedField);
    c.add(answerButton);
    c.add(exitButton);
    c.add(totalPointLabel);
    c.add(answerReport);
    c.add(TopTenScores);
    c.add(top1); c.add(top2); c.add(top3); c.add(top4); c.add(top5);
    c.add(top6); c.add(top7); c.add(top8); c.add(top9); c.add(top10);
    Message was edited by:
    tvance929

  • Help in understanding the logic!

    Can anyone help me with the following?
    Can anyone explain how the below logic works if it has the following Input values:
    Input values:
    GLOBAL1_CURR_CODE ='LOC'
    DOC_CURR_CODE ='USD'
    LOC_CURR_CODE ='USD'
    IIF(ISNULL(GLOBAL1_CURR_CODE), NULL,
    IIF(GLOBAL1_CURR_CODE = DOC_CURR_CODE, 1.0,
    IIF(DOC_CURR_CODE = 'STAT', 1.0,
    IIF(GLOBAL1_CURR_CODE = LOC_CURR_CODE, DOC_TO_LOC_EXCH_RATE_VAR,
    :LKP.LKP_W_EXCH_RATE(DOC_CURR_CODE, GLOBAL1_CURR_CODE, EXCH_DT,GLOBAL1_RATE_TYPE, DATASOURCE_NUM_ID)))))
    I am not able to find the :LKP.LKP_W_EXCH_RATE in either SDE or SIL transformations.
    Thanks in advance.
    Nikki.

    Hi again Nikki, I see you have two Oracle.com user accounts!
    This appears to relate to several issues you are having in understanding how global currencies work with the BI Applications. For the benefit of others, related threads are:-
    Informatica Logic for Balance_Global1_Amt column in W_GL_BALANCE_F table
    Informatica Logic for Balance_Global1_Amt column in W_GL_BALANCE_F table.
    Insert records into W_EXCH_RATE_G table
    Re: Insert records into W_EXCH_RATE_G table.
    Modify SIL_GLBalanceFact to populate Balance_Global1_Amt column
    Modify SIL_GLBalanceFact to populate Balance_Global1_Amt column.
    With regards to your latest question, I recognise that the SQL you have populated below has been taken from the MPLT_CURCY_CONVERSION_RATES1 mapplet in the SIL_GLBalanceFact mapping.
    To understand the logic, you need to understand the SQL used by Informatica, as well as Informatica lookup notation. Going through your example line by line:-
    GLOBAL1_CURR_CODE ='LOC'
    DOC_CURR_CODE ='USD'
    LOC_CURR_CODE ='USD'
    IIF(ISNULL(GLOBAL1_CURR_CODE), NULL,
    -- So if the GLOBAL1_CURR_CODE is null, then return NULL else...
    IIF(GLOBAL1_CURR_CODE = DOC_CURR_CODE, 1.0,
    -- if the GLOBAL1_CURR_CODE is equal to the DOC_CURR_CODE then return 1.0 else...
    IIF(DOC_CURR_CODE = 'STAT', 1.0,
    -- if the DOC_CURR_CODE is equal to 'STAT' (for statistical journals) then return 1.0 else...
    IIF(GLOBAL1_CURR_CODE = LOC_CURR_CODE, DOC_TO_LOC_EXCH_RATE_VAR,
    -- if the GLOBAL1_CURR_CODE is equal to the LOC_CURR_CODE then return the column DOC_TO_LOC_EXCH_RATE_VAR else...
    :LKP.LKP_W_EXCH_RATE(DOC_CURR_CODE, GLOBAL1_CURR_CODE, EXCH_DT,GLOBAL1_RATE_TYPE, DATASOURCE_NUM_ID)))))
    -- perform a lookup using the LKP_W_EXCH_RATE transformation (you will see this lookup on it's own in the mapplet; the colon notation above is another way to reference a lookup transformation, instead of using connectors). The five columns in the brackets are used as inputs for the lookup, if a matching record is found in the lookup table then the EXCH_RATE column is returned (check out the LKP_W_EXCH_RATE transformation for the port marked as Output).
    Please mark if helpful / correct,
    Andy
    www.project.eu.com

Maybe you are looking for

  • Error message: "iTunes cannot read the contents of the iPod."

    I wanted to get my dad a new iPod for Xmas and transfer all his music from his ancient Classic. But when I connect to my MacBookPro, I get the error message: "iTunes cannot read the contents of the iPod." I see that 90% of the ipod drive is used, but

  • How do I delete a default text message (template) that I appear to have accidentally created?

    Every time I want to send a text message and I start from scratch or I forward a text from my inbox an old message appears as a sort of template that I have to delete before I type my new message. I don't know how I created this "template" but its ve

  • CF: Checkpoxes in Report builder

    Hallo, ich versuche im Report Builder einen recht komlexen Report (Format= Excel) zu erstellen. Dabei möchte ich leere Checkboxes erstellen, die ich dann später im Excelreport markieren bzw. entmarkieren kann. Wie in einem in Excel erstellten Formula

  • Domain, Integration Server and Intergration Directory is missing

    Hi experts, After system copy, I cant find the Domain, Integration Server and Intergration Directory for the new system in the Exchange Infrastructure. The source system and target system is using the same SLD. Thanks. Regards, Thava

  • Insertar paginas de otro documento en PageMaker

    Hola! Alguien me puede ayudar? Necesito insertar páginas de un documento de PageMaker en otro de PageMaker tambien. Seria agregar un capitulo a continuacion del otro. Yo probe con la opcion que tiene el Quark, de ver en vista miniatura y arrastrar, y