Problem with Nested loop in Fox-Formula

Dear Experts,
Let s share the scenario :
MaterialGroups with following Keys for Example AAAA, BBBB, CCCC..., Materialgroups are selected in the 1st input ready query, which is assigned to DataProvider DP_1 in a  webtemplate.
every Materialgroup has several Materials, for instance:
Materialgroup AAAA has following Materials: AAAA10, AAAA11, AAAA12, AAAA13...
Materials are  selected in a second  input ready Query, which is assigned to a second DataProvider DP_2 in the Same Webtemplate as the query 1.
Both Materialgroup and Material are based on the same Aggreagtion level and same real time cube.
I want to copy the input values for every  MaterialGroup ( 1st query, DP_1) only to it s own Materials (2cond Query, DP_2).
To resolve this Issue i wrote the following Fox Formula code with a nested loop, however it does not work properly. when I m debugging the code, i could release that the second Loop was ignored.but wehn i replace the second loop (nested loop) with a fixed value it s seems to work properly
DATA MG1 TYPE MATG.<------ MaterialGroup
DATA MT1 TYPE MAT.<----
Material
DATA S1 TYPE STRING.
DATA S2 TYPE STRING.
DATA S3 TYPE STRING
DATA K TYPE F.
DATA Z TYPE F.
FOREACH MG1.
To check Materialgroup in debugger
S1= MG1.
BREAK-POINT.
K = {KEYfIG, #, MG1}.
BREAK-POINT.
FOREACH  MT1.   <----- if i set MT1 to a fixed value like AAAA11 then S3 get the wished value namely AAAA
S2 = MT1.
BREAK-POINT.
S3 =  SUBSTR (MT1, 0, 4).  
BREAK-POINT.
IF S1 = S3.
{KEYFIG, MT1, #} = K.
following Statement is only used To check in debugger if Material has become the same Materialgroup value
Z = {KEYFIG, MT1, #}.
BREAK-POINT.
ENDIF.
ENDFOR.
ENDFOR.
Thakns for any help
Frank
Edited by: FRYYYBM on Mar 17, 2011 10:54 PM
Edited by: FRYYYBM on Mar 17, 2011 11:06 PM

Hi,
Please try this way.
DATA MG1 TYPE MATG.<------ MaterialGroup
DATA MT1 TYPE MAT.<----
Material
DATA S1 TYPE STRING.
DATA S2 TYPE STRING.
DATA S3 TYPE STRING
DATA K TYPE F.
DATA Z TYPE F.
FOREACH MT1.
FOREACH MG1.
To check Materialgroup in debugger
S1= MG1.
BREAK-POINT.
K = {KEYfIG, #, MG1}.
BREAK-POINT.
FOREACH MT1. <----- if i set MT1 to a fixed value like AAAA11 then S3 get the wished value namely AAAA
S2 = MT1.
BREAK-POINT.
S3 = SUBSTR (MT1, 0, 4).
BREAK-POINT.
IF S1 = S3.
{KEYFIG, MT1, #} = K.
following Statement is only used To check in debugger if Material has become the same Materialgroup value
Z = {KEYFIG, MT1, #}.
BREAK-POINT.
ENDIF.
ENDFOR.
ENDFOR.
ENDFOR.
Thanks.
With regards,
Anand Kumar

Similar Messages

  • Problem with nested loops  in collections

    Hi All,
    I am trying to insert data captured on a form(elements) into a database table thru a view.
    I have a process for insert that looks like..
    for x in (select * from htmldb_collections where collection_name = 'PARTY')
    loop
    for i in 1..50
    insert into imds_part_num (mdb_nr,part_nr) values(:P5_MDB_NR,to_number(x.c00(i)));
    end loop;
    end loop;
    the error is 'C00' must be declared.
    I have no error when i tried to insert with process like this....
    for x in (select * from htmldb_collections where collection_name = 'PARTY')
    loop
    insert into imds_part_num (mdb_nr,part_nr) values(:P5_MDB_NR,to_number(x.c001));
    end loop;
    i have 50 items on my form page . i added members into the collection like this,
    htmldb_collection.add_member(p_collection_name => 'PARTY',
    p_c001 => :P5_ENTWICKLUNGSNUMMER,
    p_c002 => :P5_GEHAEUSE_PT,
    p_c003 => :P5_GEHAEUSE,
    p_c004 => :P5_PRESSTEIL,
    p_c005 => :P5_MAEL ,
    p_c006 => :P5_KGE_WNZ......, before the process mentioned above....
    I see the collection as a VARRAY.
    Cud somebody point me the mistake, or a workaround for this.
    Thank you.

    Chalamalasetty,
    When you have -
    x.c00(i)You're actually trying to access the Nth item in an array, for example if i=2 then you're trying to access the 2nd item in the c00 array.
    However, your query which performs the select from htmldb_collections is not returning an array called c00, it does infact return distinct columns such as -
    jes@DBTEST> desc htmldb_collections;
    Name                                         Null?    Type
    COLLECTION_NAME                              NOT NULL VARCHAR2(255)
    SEQ_ID                                       NOT NULL NUMBER
    C001                                                  VARCHAR2(4000)
    C002                                                  VARCHAR2(4000)
    C003                                                  VARCHAR2(4000)
    C004                                                  VARCHAR2(4000)
    C005                                                  VARCHAR2(4000)
    C006                                                  VARCHAR2(4000)
    ....... extra lines deleted .......So you would need to specify the columns individually. If you wished to do this dynamically then you would need to make your insert statement a dynamic statement and build it up as a string.
    If you can explain precisely what you're trying to achieve then it will be easier to suggest alternative ways of doing it.

  • Problem with while loops, please help!

    I am having quite a bit of trouble with a program im working on. What i am doing is reading files from a directory in a for loop, in this loop the files are being broken into words and entered into a while loop where they are counted, the problem is i need to count the words in each file seperately and store each count in an array list or something similar. I also want to store the words in each file onto a seperate list
    for(...)
    read in files...
         //Go through each line of the first file
              while(matchLine1.find()) {
                   CharSequence line1 = matchLine1.group();
                   //Get the words in the line
                   String words1[] = wordBreak.split(line1);
                   for (int i1 = 0, n = words1.length; i1 < n; i1++) {
                        if(words1[i1].length() > 0) {
                             int count= 0;
                                           count++;
                             list1.add(words1[i1]);
              }This is what i have been doing, but with this method count stores the number of words in all files combined, not each individual file, and similarly list1 stores the words in all the files not in each individual file. Does anybody know how i could change this or what datastructures i could use that would allow me to store each file seperately. I would appreciate any help on this topic, Thanks!

    Don't try to construct complicated nested loops, it makes things a
    tangled mess. You want a collection of words per file. You have at least
    zero files. Given a file (or its name), you want to add a word to a collection
    associated with that file, right?
    A Map is perfect for this, i.e. the file's name can be the key and the
    associated value can be the collection of words. A separate simple class
    can be a 'MapManager' (ahem) that controls the access to this master
    map. This MapManager doesn't know anything about what type of
    collection is supposed to store all those words. Maybe you want to
    store just the unique words, maybe you want to store them all, including
    the duplicates etc. etc. The MapManager depends on a CollectionBuilder,
    i.e. a simple thing that is able to deliver a new collection to be associated
    with a file name. Here's the CollectionBuilder:public interface CollectionBuilder {
       Collection getCollection();
    }Because I'm feeling lazy today, I won't design an interface for a MapManager,
    so I simply make it a class; here it is:public class MapManager {
       private Map map= new HashMap(); // file/words association
       CollectionBuilder cb; // delivers Collections per file
       // constructor
       public MapManager(CollectionBuilder cb) { this.cb= cb; }
       // add a word 'word' given a filename 'name'
       public boolean addWord(String name, String word) {
          Collection c= map.get(name);
          if (c == null) { // nothing found for this file
             c= cb.getCollection(); // get a new collection
             map.put(name, c); // and associate it with the filename
          return c.add(word); // return whatever the collection returns
       // get the collection associated with a filename
       public Collection getCollection(String name) { return map.get(name); }
    }... now simply keep adding words from a file to this MapManager and
    retrieve the collections afterwards.
    kind regards,
    Jos

  • Need help with nested loop (c:forEach) tags. Can I break from inner loop?

    Hi all, I have this annoying problem and I am looking for any suggestions.
    I have 2 select boxes. One is for all available users, and second - for selected users (designated as admins). The list of all users is available in a collection (2 properties userId and userName displayed in the code below). The list of admins contains only userId (as strings).
    I have no problem with populating selected users (admins) list, reusing pretty much the same logic below, but I cannot find a way to break out from the nested loop once the match is found, to avoid repetitions leading to incorrect display of results.
    <select name=available>
    <c:forEach items="${users}" var="user" varStatus="outer">
        <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
            <c:if test="${user.userId!=adminId">
                 <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
            </c:if>
        </c:forEach>
    </c:forEach>
    </select>
    <select name=selected>
    <c:forEach items="${users}" var="user" varStatus="outer">
        <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
            <c:if test="${user.userId==adminId">
                 <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
            </c:if>
        </c:forEach>
    </c:forEach>
    </select>Can anyone help, please? I am also restricted to JSP 1.2

    Double post: http://forum.java.sun.com/thread.jspa?threadID=707950&tstart=0

  • Qsm pc, problem with stop loop

    Hello,
    i tested queue producer/consument with event case, but i have problem with stop the both loop, can you help me with attachment ?
    Attachments:
    queue_mereni_1.zip ‏46 KB
    Global_queue.zip ‏3 KB

    thanks for your answer,
    i had problem with upload *.vi (some mistake), so when a upload *.zip it was ok, but i do not know why..
    please, when i put time out constatn, so when i push "stop" then both loops end - it is ok BUT:
    when i push "stop 2" button (for the second loop) so there is error (in attachment), please do you know why?
    i am sorry for a lot of questions but i try understand it..
    thank you
    Attachments:
    qsm.jpg ‏31 KB

  • Problem with a loop

    Hello All
    I'm working on a Flash Gallery and I'm having some issues
    with a loop and it's probably something simple I don't know so I
    thought I'd see if someone can help me.
    the problem is that once the thumbnail panel is populated the
    image I want to display from a rollover is no longer defined. As I
    mentioned I was hoping someone could shed some light on this.
    [code]
    // create the thumbnail panel
    var i = -1;
    while(++i<thumbList.length) {
    name = "item"+i;
    thumbs_mc.duplicateMovieClip(name,i);
    this[name]._x = i*spacing;
    this[name].contentPath = "children/" + thumbList
    // show the larger pic on rollover
    this[name].onRollOver = function() {
    picture.contentPath = "children/" + thumblist;
    [/code]
    by using this I get an error of: "error opening
    URL...undefined"

    mark2685 wrote:
    Well, the array of student objects is larger than 2, there are about 6 students so it would have to get the highest from TestScore 1 and the lowests from TestScore 2 out of all of the students, not just those 2. And I want the entire object stored in the chessTeam array. Does this make sense?No you're not reading my code right (BTW - add an open brace on the for loop top and set score2 to 101), or else I'm not understanding you requirements correctly. The student array can hold as many Students as needs be. You stated that you have only two scores that you care about and so that's the 1 and the 2. Based on the Student class you've shown us, this should work, but you'll have to try it before you know.

  • Bulk collect with Nested loops

    Hi I've a requirement like this
    I need to pull request nos from table a(Master table)
    For every request no I need to pull request details from table b(Detail Table)
    For every request no I need to pull contact details from table c
    For every request no I need to pull customer data table d and I need to create a flat file with that data so I'm using utl_file in normal query criterion because of nested loops it's taking lot of time so I want to use bulk collect with dynamic query option:
    Sample code
    =======
    create or replace procedure test(region varchar2) as
    type tablea_request_typ is table of varchar2(10);
    tablea_data tablea_request_typ;
    type tableb_request_typ is table of varchar2(1000);
    tableb_data tableb_request_typ;
    type tablec_request_typ is table of varchar2(1000);
    tablec_data tablec_request_typ;
    type tabled_request_typ is table of varchar2(1000);
    tabled_data tabled_request_typ;
    stmta varchar2(32000);
    stmtb varchar2(32000);
    stmtc varchar2(32000);
    stmtd varchar2(32000);
    rcura SYS_REFCURSOR;
    rcurb SYS_REFCURSOR;
    rcurc SYS_REFCURSOR;
    rcurd SYS_REFCURSOR;
    begin
    stmta:='select  request_no from tablea where :region'||'='NE';
    stmtb:='select  request_no||request_detail1||request_detail2 stringb  from table b where :region'||'='NE';
    stmtc:='select contact1||contact2||contact3||contact4  stringc from table c where :region'||'='NE';
    stmtd:='select customer1||customer2||customer3||customer4  stringd  from table c where :region'||'='NE';
    OPEN rcura for stmta;
      LOOP
      FETCH rcura BULK COLLECT INTO request_no
      LIMIT 1000;
      FOR  f in 1..request_no.count
    LOOP
    --Tableb
        OPEN rcurb for stmtb USING substr(request_no(f),1,14);
      LOOP
      FETCH rcurb BULK COLLECT INTO tableb_data
    for i in 1..tableb_data.count
    LOOP
    utl_file(...,tableb_data(i));
    END LOOP;
        EXIT WHEN rcurb%NOTFOUND;
      END LOOP;
    -- Tablec
    OPEN rcurc for stmtc USING substr(request_no(f),1,14);
      LOOP
      FETCH rcurb BULK COLLECT INTO tablec_data
    for i in 1..tablec_data.count
    LOOP
    utl_file(...,tablec_data(i));
    END LOOP;
        EXIT WHEN rcurc%NOTFOUND;
      END LOOP;
    -- Tabled
    OPEN rcurd for stmtd USING substr(request_no(f),1,14);
      LOOP
      FETCH rcurd BULK COLLECT INTO tabled_data
    for i in 1..tabled_data.count
    LOOP
    utl_file(...,tabled_data(i));
    END LOOP;
        EXIT WHEN rcurd%NOTFOUND;
      END LOOP;
      END LOOP;
        EXIT WHEN rcura%NOTFOUND;
      END LOOP;
    exception
    when other then
    dbms_output.put_line(sqlerrm);
    end;I 'm using code mentioned above but request nos are repeating as if it's an infinete loop ?for ex if request no is 222 It should run once but here it's running more than once?
    How to pass bind parameters say in my case region?
    Are there any alternate solutions to run it faster apart from using bulk collect?
    Right now I'm using explicit cursor with for loop which is taking lot of time ?so is this better sol?
    Thanks,
    Mahender
    Edited by: BluShadow on 24-Aug-2011 08:52
    added {noformat}{noformat} tags. Please read {message:id=9360002} to learn to format your code/data yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

        Use Parameterized cursor :
    CREATE OR REPLACE PROCEDURE test(region varchar2)
    AS
      type tablea_request_typ is table of varchar2(10);
      type tableb_request_typ is table of varchar2(1000); 
      type tablec_request_typ is table of varchar2(1000);
      type tabled_request_typ is table of varchar2(1000);
      tablea_data tablea_request_typ;
      tableb_data tableb_request_typ;
      tablec_data tablec_request_typ;
      tabled_data tabled_request_typ;
       CURSOR rcura(v_region  VARCHAR2(100))
       IS
       select  request_no from tablea where region = v_region;
       CURSOR rcurb(v_input  VARCHAR2(100))
       IS
       select  request_no||request_detail1||request_detail2 stringb  from table b where request_num = v_input;
       CURSOR rcurc(v_input  VARCHAR2(100))
       IS
       select  select contact1||contact2||contact3||contact4  stringc from table c where request_num = v_input;
       CURSOR rcurd(v_input  VARCHAR2(100))
       IS
       select  select customer1||customer2||customer3||customer4  stringd  from table c where request_num = v_input;
    BEGIN
    OPEN rcura('NE');
    LOOP
        FETCH rcura BULK COLLECT INTO request_no  LIMIT 1000;
        FOR  f in 1..request_no.count
        LOOP
           --Tableb
           OPEN rcurb(substr(request_no(f),1,14));
           LOOP
              FETCH rcurb BULK COLLECT INTO tableb_data
              for i in 1..tableb_data.count
              LOOP
                  utl_file(...,tableb_data(i));
              END LOOP;
              EXIT WHEN rcurb%NOTFOUND;
           END LOOP;
           -- Tablec
           OPEN rcurc (substr(request_no(f),1,14));
           LOOP
              FETCH rcurb BULK COLLECT INTO tablec_data
              for i in 1..tablec_data.count
              LOOP
                 utl_file(...,tablec_data(i));
              END LOOP;
              EXIT WHEN rcurc%NOTFOUND;
           END LOOP;
           -- Tabled
           OPEN rcurd ( substr(request_no(f),1,14) );
           LOOP
              FETCH rcurd BULK COLLECT INTO tabled_data
              for i in 1..tabled_data.count
              LOOP
               utl_file(...,tabled_data(i));
              END LOOP;
              EXIT WHEN rcurd%NOTFOUND;
           END LOOP;
      END LOOP;
    EXIT WHEN rcura%NOTFOUND;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
       dbms_output.put_line(dbms_utility.format_error_backtrace);
    END;
    /Hope this helps. If not, post your table structures...

  • Strange problem with nested address book groups

    I have a strange problem with iSync. I have created a group On-the-Go in my Address Book that I'm syncing with my phone (Motorola v600). The group consists of three other groups. Let's call them A, B and C.
    The problem is that only group C gets synchronized. Contacts from groups A and B disappear from the phone. Strangely, if I select A or B to sync in iSync - they get synchronized just fine. Also, group C, in turn, contains other nested groups, but that does not seem to be a problem.
    I played with group names, tried to recreate group A to no avail.
    For now, I have added all contacts from A and B to On-the-Go as a workaround, but
    it looks like a bug to me.

    I have a strange problem with iSync. I have created a group On-the-Go in my Address Book that I'm syncing with my phone (Motorola v600). The group consists of three other groups. Let's call them A, B and C.
    The problem is that only group C gets synchronized. Contacts from groups A and B disappear from the phone. Strangely, if I select A or B to sync in iSync - they get synchronized just fine. Also, group C, in turn, contains other nested groups, but that does not seem to be a problem.
    I played with group names, tried to recreate group A to no avail.
    For now, I have added all contacts from A and B to On-the-Go as a workaround, but
    it looks like a bug to me.

  • Problem with Nested tell blocks in Applescript

    Hello everyone,
    I've been trying to do a little Applescript, whose purpose is to open a file selector to let the user choose a bunch of images, then prompt him to ask a resizing ratio, and then resize the chosen pictures accordingly (after duplicating the originals in a folder on the desktop, the copied files being the ones resized).
    I'm having problems with the resizing part... Here is the code I've come up with so far... "Image traitées" is the name of the new folder created on the desktop, and "compression" is the factor in %.
         -- Resizing 
         tell application "Finder"
              repeat with photo in folder "Images traitées" of desktop
                   tell application "Image Events"
                        launch
                        scale photo by factor compression * 0.01
                   end tell
              end repeat 
         end tell
    I'm encountering an error number -1708, saying that the 'photo' item doesn't understand the scale message...
    As I'm new to Applescript, I have some difficulties solving this... Could it be due to the nested tell blocks ?
    Thanks a lot for your help !
    Thomas

    Your tell statements are OK, although when nesting them you do need to keep track of what application is getting targeted in any given statement (to avoid terminology conflicts).
    Each application refers to its objects in its own way - unfortunately, not everything knows about Finder references.  Your photo variable contains a Finder reference (e.g. "file x of folder y of disk z"), but Image Events doesn't know what that is.  The solution is to convert the Finder reference to something more standard, such as text or an alias.
    Your script won't work with just that change, however.  Image Events works with the image contained in a file, so you also need to actually get that image, for example:
    set compression to 80 -- used in the following snippet
    tell application "Image Events" to launch -- just need to do this once
    tell application "Finder"
         repeat with photo in folder "Images traitées" of desktop
              tell application "Image Events"
                   set theImage to open (photo as alias) -- get the image from the Finder reference
                   scale theImage by factor compression * 0.01
                   save theImage -- save the changed image
              end tell
         end repeat
    end tell

  • Probably simple problem with while loops

    I was programming something for a CS class and came across a problem I can't explain with while loops. The condition for the loop is true, but the loop doesn't continue; it terminates after executing once. The actual program was bigger than this, but I isolated my problem to a short loop:
    import java.util.Scanner;
    public class ok {
    public static void main(String[] args){
         Scanner scan = new Scanner(System.in);
         String antlol = "p";
         while(antlol == "p" || antlol == "P"){
              System.out.println("write a P so we can get this over with");
              antlol = scan.nextLine(); 
    //it terminates after this, even if I type "P", which should make the while condition true.
    }

    Thanks, that worked.
    I think my real problem with this program was my CS
    teacher, who never covered how to compare strings,Here's something important.
    This isn't just about comparing Strings. This applies to comparing ANY objects. When you use == that compares to see if two references refer to the same instance. equals compares objects for equality in the sense that equality means they have equal "content" as it were.

  • Massive problems with nested multi-cam sequences

    Hey all,
    I'm absolutely pulling my hair out over some issues I'm having and hope somebody out there might have an answer.  I'm creating a short interview project, including interviews of two people individually, with two separate cameras and external sound capture.  My goal is to cut between their separate answers to each question.  For each interview I created a multi-cam sequence within its own timeline.  Then, in my master sequence, I used the source monitor to pull out the specific clips from each interview sequence which I wanted to include, and assembled them into the master timeline.
    I'm having two difficulties.  First, for whatever reason, I'm experiencing audio glitching when the cuts between sequence clips occur.  The glitch is like an audio "scramble," lasts about a half second, plenty of time to be distracting and detract from the whole of the project.  There are no such audio glitches present when viewing the interview sequences specifically.  I had applied effects to the audio tracks both within the interview sequences and the master sequence.  I've since disabled every effect but the problem persists, and it is still present upon rendering the master timeline.  I have absolutely no idea what to do about this.
    The second issue is more general.  I've got my media cache on an internal SSD, and I'm pulling my media from an internal HDD, with Premiere Installed on a different SSD with my operating system.  The two interview sequences play back wonderfully, no delays whatsoever.  The master timeline, however, with all the clips extracted from the interview sequences, plays slow as molasses.  It takes 10-15 seconds for the play head to even start moving once I click 'play', which has made this entire process excruciatingly difficult.  Is this a known issue?  Why would my performance be so completely degraded working with nested sequences?  Isn't everything referencing the exact same files?
    Ugh, long night working on this.  Thank you for any help.

    Well, I've come up with a terrible, but comical solution for the second issue which doesn't involve reworking anything.  It turns out that, upon launching premiere, I can play the master sequence with nested multi-cam sequences a grand total of ONCE with minimal delay.  If I stop the play through, then it will take 3-4 minutes to get the sequence playing again.  Of course, the Premiere decides to hang when I try to close it after playing this master timeline, so I'm finding that I can inch my way through this project by (1) launching premiere, (2) playing the master sequence, (3) make the edits I need, (4) forcibly crash Premiere, and (5) relaunch Premiere and repeat.  It's a terrible way to work, but the project is so close to completion that I'm willing to suffer through it.
    As to issue 1, I've taken each offending clip, extending the audio track one or two frames in the beginning of each clip, and then use those frames to ramp the volume up from silent to 0db.  This seems to avoid the brief moment of distortion at the beginning.  Notably I did try your suggestion by going back to the original, source audio, but I was still getting the same issue.  My work-around is the only solution I've been able to come up with.

  • A problem with for loop..

    i have a problem with this code :
         int [] P = new int [M.length];
         System.out.println(P[0]+" "+P[15]);     
         for (int i = 0 ; i < P.length ; i++){
         for (int j = i + 1 ; j < P.length ; j++){
              if (j == (P.length - 1) && M [ i ] != M [ j ]){
                        P [ i ] = M [ i ] ;
                   else if ( M [ i ] != M [ j ] ) continue ;
                   else break;
         for (int i = 0 ; i < P.length ; i++){
              System.out.println(P [ i ]);
    this code to copy distinct values in array M and print them into array P
    M and P are both of size 16
    the problem is the previous code doesn't work for P[15]
    and i don't know way
    if i have in M {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
    P will be {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}
    could any body help ?

    I am sorry, but you are not done. May-be your code does what it is supposed to do but it is hard to understand. An important part of programming is not just to get your code to work, but to write code that is easily maintainable. You are probably quite new programming and I do not want to discourage you. Keep working hard and it will come.
    You almost had the solution a while back:
            int [] P = new int [M.length];
         System.out.println(P[0]+" "+P[M.length]);
            boolean unique;
         for (int i = 0 ; i < P.length ; i++){
             // All non-zero entries in P with index less than i are unique in M.
               unique = true; //Assume M[i] unique until contrary has been proven
            for (int j = 0 ; j < P.length ; j++){
              if (i != j && M[i] == M[j]) { //found another entry in M with the same value as M[i]
                            unique=false;
                   break;
               if (unique) { // M[i] is unique in M.
                  P[i] = M;
         for (int i = 0 ; i < P.length ; i++){
              System.out.println(P [ i ]);
         }This code executes in time O(n^2). It is possible to achieve O(nlog(n)) by
    1) copy M into P
    2) sort P
    3) iterate through P and set duplicates to 0.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problems with adding loops

    Hey I had my Mac for awhile now (Mac Mini) and I just upgraded to Leopard a few day ago. I'm having problems transferring loops onto the loop index..I tried the drag and drop and sometimes only a few get through but not all. And when I try again a prompt comes up saying there is already a folder with that name...etc. Is there a solution to get all of my loops onto the loop index. Im pretty new to GB and I dont know the best way..help plz!

    If you want to record multiple audio tracks, you have to shift-click on each record button and make sure both are on different inputs.

  • Problem with nesting repetitive groups, using PDF as template

    We are trying to use a pdf file (Acrobat 5.0) as a template for BI Publisher reports.
    Our report uses as a data source a xml file (facturas.xml) with data from several bills.
    In each bill, there are areas where multiple lines must be displayed. We use the tag BODY_START/BODY_END to define the area of repetition for the lines.
    The problem arises when we want to nest two or more BODY_START/BODY_END. In this case the fields are displayed outside the place where they were defined.
    We do not know the way to do it and the syntax for nesting repetitive groups.
    BI Publisher Version: Oracle BI Publisher 10.1.3.4.1
    Plattform: Windows 2003 R2 64 bits.
    Acrobat: Using Acrobat 5.0 file format.
    Editor: Adobe Acrobat 9, saving as 5.0 file format.

    I have found some solution whcih guide you to how to create links in PDF file. Follow this interesting PDF guide here.
    Video Guide of How To Create eBook using Adobe Acrobat.
    Hope it helps you.

  • Problem with one loop in another one

    When I drag and move cursor, X scale position will be show below. And then I click “add data in array”, the data should be put into array. I can move cursor again to add the second , the third ….into array.
    My problem is:
    In block diagram, once loop2 is outside of loop 1, it works. But I really want loop2 is in loop1 regarding to the rest part of the program. However, we I move loop2 into loop1, when I move cursor, nothing happens.
    Please help to make it work or you have different way to do this job.
    Thank you very much
    Liming
    Attachments:
    yxxx.vi ‏29 KB

    Hey, no need to make it so complicated.  Just add an indicator on the CursLoc.X wire in the  "0 To 5 MHz": Cursor Move  case.
    To answer your questions:
    1) The indicator does not react because you are still within the inner while loop.  It will not change until that loop completes. I.e. the stop button is pressed.
    2) Similarly, the stop 2 button will press, but nothing will happen until the inner loop is done.
    Generally, when I am using an event structure, I try to keep all the changing UI inputs and outputs in the same while loop with the event structure, if not in the event structure itself.  Local variables and property nodes can get the job done, but they are inefficient and can be difficult to debug.  As I am sure you are discovering
    Message Edited by jasonhill on 04-07-2006 12:40 PM
    Attachments:
    cursor position indicator.PNG ‏7 KB

Maybe you are looking for

  • How can I replace soundtrack in QT7 movie by other one?

    Hi There, I am trying to replace soundtrack from one movie by other soundtrack of better quality al in the same movie. How it can be done in QT7? And can I adjust it some video does not overlap audio? I am experimenting with movie properties window b

  • OIM 11g High Availability Deployment

    Hi Experts, I'm deploying OIM 11g in High Available schema, following Oracle docs: http://download.oracle.com/docs/cd/E14571_01/core.1111/e10106/imha.htm#CDEFECJF, I have succesfully installed and configured OIM & SOA in weblogic domain on 'OIMHOST1'

  • How to install Air 3.3 in Flash cs5.5

    I found this link, but that only relates to Air 3.0 http://helpx.adobe.com/x-productkb/multi/overlay-air-sdk-flash-professional.html Is it the same for overlaying with Air 3.2?

  • Purchase Requistion and ATP / commited quantity

    Hi SAP Business Process Experts, Business Process we use STO's/STR's (purchase orders/purchase requisitions) to supply other plants. The STO/Purchase order between plants is created for the 'frozen' period, whilst STR's/Purcahse Requisitions are crea

  • EGO Item Description creation substr

    Hallo, using EGO in 11i or R12.0.4 with item description function based. someone told me, that there exists a configuration page where you can define e.g. "from 3rd to 5th" of the Description of Attribute1 and "from 7th to 8th" of Attribute2. Now the