Is it possible to put a loop inside a CREATE statement?

Hi,
Is it possible to put a for loop inside a Create statement? Obviously, I've tried it and am getting errors, but I just want to know is it at all possible!?
I want to create a dynamic table where the number of fields is dependent on the number of items the user enters!
This is what I have tried, but it tells me:Error #: 204 : illegal start of expression
String createDatabase = "CREATE TABLE " TheTopic
for (int i=0; i < ListBox.getModel().getSize(); i++)
"(Item"+i+" VarChar(20))";
stmt.executeUpdate(createDatabase);
Is there anyother way of doing what I am trying to do?

>
Is there anyother way of doing what I am trying to do?You might want to reconsider your design unless you are creating software to manager, rather than use, a database.
If managing then, obviously, the user would want to create tables, delete them, etc.
But if using then managing these tables is going to be a problem. If so you should first examine that you really want to do this. If yes, then consider a meta-data design. A meta design might look like.
    Table_Name
         Table_id
         Table_name
    Table_Field
         Field_id
         Table_id
         Field_name
         Field_type
    Table_Value
         Value_id
         Field_id
         Value_value
With the above instead of creating a new table each time, you just add entries to the first and second tables.

Similar Messages

  • Is it possible to put property node inside for loop?

    I have created three separate property nodes (plot color) for my 3 XY graphs.
    Is it possible to have one property node, say plot_color_i and put this inside the for loop where i runs from 1 to N,
    where plot_color_1 would update XY Graph 1, plot_color_2 would update XY Graph 2, etc.?
    See the attached VI.
    Solved!
    Go to Solution.
    Attachments:
    XY Plot Example.vi ‏18 KB

    Yes.  Create an array of references of the XY graphs and have that auto-index into the property node in the For Loop
    Attachments:
    XYPlotExampleMOD.vi ‏18 KB

  • Is It Possible To Put A Video Inside A Video Like A News Channel Does?

    I was wondering if there was a way to put a little movie box inside of another video.
    Like the news has in the upper right hand corner when they are talking about something.
    Here is what I am talking about:
    http://img297.imageshack.us/img297/7869/alexis12nk.jpg
    Just wondering if it is possible in iMovie and if so then how could it be done?
    Thanks,
    Sam

    You can also do this with QuickTime Pro. See Klaus1's post here: http://discussions.apple.com/thread.jspa?threadID=933500&tstart=50

  • [svn:osmf:] 14765: Put gate around autoRewind code, to prevent possibility of an infinite loop ( which could happen if you create a SerialElement with the last child a DurationElement of duration zero ).

    Revision: 14765
    Revision: 14765
    Author:   [email protected]
    Date:     2010-03-15 13:48:04 -0700 (Mon, 15 Mar 2010)
    Log Message:
    Put gate around autoRewind code, to prevent possibility of an infinite loop (which could happen if you create a SerialElement with the last child a DurationElement of duration zero).
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/media/MediaPlayer.as

    Step by step, how did you arrive at seeing this agreement?

  • How can I put a subpanel inside another subpanel?

    Hi,
    Is it possible to put one subpanel o several subpanels inside one main subpanel?
    Thanks,
    ToNi.

    DFGray wrote:
    You can create something in LabVIEW to do this, but it won't be trivial. Here are some things to point you on your way. I have not done this, so it is pure speculation on how I would go about solving this problem.
    You will need to know ahead of time the maximum number of windows you will want. On your front panel, create that many individual subpanels. You can hide the border and make them transparent so you never see them unless something is in them.
    When you load a VI into the subpanel, all you get is the panel, not the title bar. You will need to create a title bar with buttons and any border you want on the VIs in the panel area. This is tedious, but fairly straightforward, especially if you use system colors to make it look like a real title bar/border. You won't be able to make it look like an XP title bar unless you use bitmaps/picture control. If you go that route, you can probably even mess with the color map to change the bitmap colors when the system color changes (have to poll, no event for system color change).
    You can resize and move the subpanels using property nodes. Getting the info to do this could be tricky, however, since you may be coordinating mouse events from the top level VI and the VI hosted in the subpanel. Should be doable, though.
    One other method is to use floating windows, but move them on top of your main window so it appears to the user it is an MDI. You won't get clipping, but everything else will look the same and you won't have to jump through hoops to create title bars, etc. You will have to write a position manager to maintain the window positions, but that is probably easier than the tricks I discussed above
    Good luck. One final question - do you really need an MDI? Floating windows with clear labels are a lot easier. Do some polling of your users to find out what they like best, then go for it.
    You should using windows reparenting functionality through windows api dll calls. Reparenting is documented well on microsoft.com. Reparenting is how Excel opens multiple worksheets inside the Excel "parent" window. I have done this on a few of projects and it works far better than subpanels because it allows you to drag windows around within a parent application. They are also far easier to work with once you get the reparenting vi's correct (you have to do some messing with Z position and window activation to get them to repaint properly) because unlike with subpanels you can view a VI diagram while it is reparented with no problem. With subpanels I have also had problems with GUI controls driving event structures when a vi is in a subpanel.
    -Devin
    I got 99 problems but 8.6 ain't one.

  • Smart form - loop inside a loop

    Dear Techies,
      I am new to smartforms. I have a query, in one of the code examples there is a context menu on the main window called "complex selection", but i dont find the same in my editor, what is the reason.
      I want this because i have data in two internal tables. Different tables are generated from secondary depending on the entries in first table. how do i achieve this on the main window.
    Similar to loop inside a loop, depending on my first table entries, all the entries belonging to that entry are to be put in table of second entry. i will have tables equal to the entries in first internal table. hope my question is clear.
    Please help.
    Regards
    imran.

    Hye..
      Loop in main area will fill only the current table, but i want several tables depending on entries in the first internal table.  The number of tables in the main window will be the number records in the first table.
    Regards
    imran.

  • How to put an MSO inside another MSO

    Hello all!
    An interesting question came up in the following post by Folobo:
    http://forums.adobe.com/message/4572897#4572897
    "Is it possible to use a slideshow embedded in a big overlay slideshow?"
    I'd like to rephrase this question:
    "Is it possible to put a MultiStateObject (MSO) inside another MultiStateObject?"
    And further: if the answer is "yes", could we put that to use with the DPS?
    @Folobo – this is an interesting question. A quick test is showing that you cannot do it in the UI (correct me if I'm wrong).
    Let's try it this way:
    If you have two objects:
    1. an MSO #1 (with two rectangles, rectangle #1, rectangle #2)
    2. Another rectangle on the page: rectangle #3
    Now select the two objects and make an MSO out of it (using the "Object States" panel).
    You would think, now I get an MSO with two states, state 1 with rectangle #3 together with state 2 with MSO #1.
    But not so:
    Result: One new MSO with three states (rectangle #1, rectangle #2, rectangle #3)
    Hm. I don't give up on that. Let's try it another way:
    Could we select at least two objects inside a state of an MSO and make that a new MSO?
    Sure, We could select two objects inside a state, but since we are *inside* an MSO the "Object States" panel does not show the possibility to make a new MSO. You can only add states or add objects to states…
    Frustrating. End of story? Maybe…
    Be forewarned. The following is highly experimental!
    Let's try it by scripting (ExtendScript/JavaScript).
    The scripting reference is showing that an MSO "MultiStateObject" object has an add()-method. And further on, that add()-method could be applied to:
    Document
    Spread
    MasterSpread
    Page
    Layer
    pageItem
    And that is the key to a possible solution. We could add a new MSO to a "pageItem" object.
    A simple rectangle should be qualify for a "pageItem" object; and that, of course, could reside in a state of an MSO.
    So, we could add a new MSO to a rectangle inside of a MSO!
    How can we access a rectangle inside a MSO? Easy: We could select it and work with that selection.
    So let's do that: select the rectangle in the first state of an MSO and run this one-line-script (be sure you did select the rectangle and not the MSO or one of its states:
    app.selection[0].multiStateObjects.add();
    We now have an MSO inside another MSO!
    Explanation:
    A "generic MSO" was added with the add()-function to a selection (the container object: in our case the selected rectangle).
    The "generic MSO" is a two state MSO consisting of one rectangle in each state of a very small size (10px x 10px).
    At first it is invisible, because it is very likely that it is positioned outside the geometric bounds of its container object (the rectangle).
    But we can customize this!
    Go to the layers palette and select the new MSO, move it inside the geometric bounds of its container object, readjust its size, add states as you wish, populate the states with images, and other objects etc.pp.
    So, what can we do with an MSO inside another MSO? (As I already said, this is highly experimental.)
    My experiments with that are very fresh. I did not try a lot. But it seems that we could at least autoplay this MSO.
    I have to test more thoroughly what is possible and what will work with buttons etc.pp…
    I really like to hear from you what you will find out and if you can put it to any use.
    Uwe
    Message was edited by: Laubender

    @Mobly – in case it did not work out for you, here some screen grabs for the different steps:
    1. Select an MSO:
    2. Select a "graphic frame" inside the MSO; in this case a "<square>"; you can see the big blue dot in the Layers panel behind the generic name "<square>":
    3. Open the Scripts Panel and select the script:
    4. Run the script by double-clicking the script; the generic name of your selected object has changed to "graphic frame", but trust me, it's still a square…
    5. Click the "Ok" button of the message and InDesign will select the new MSO ("Multi-state 2") as you can see here. It has two states with one rectangle each,  fill and stroke is "None":
    And: you can see that this new MSO is nested inside the MSO ("Multi-state 1").
    What you do with that construct is up to you:
    6. Color the "<square>" of state 1 of "Multi-state 2":
    7. Resize and change position of "Multi-state 2":
    8. But remember: "Multi-state 2" is nested in the graphic frame you selected before running the script:
    I hope you get the picture now…
    Uwe

  • How to avoid the loop inside the loop? as it reduces the performance.

    hi masters,
    i have 2 internal tables having 1 same field. eg table itab having f1, f2, f3 fields and itab1 having f1, f4 and f5 fields. let us consider the data in the itab and itab1 is like below given
    itab-f1   itab-f2   itab-f3                 itab1-f1     itab1-f4   itab1-f5
    10        aa         11                      10             abc       456
    10        bb         15                      10             def        655
    10        ff           13                      10             ghi        456
    11        dd         16                      10             tre         455
    11        zz         24                      11             ftr          256
    11        ii           54                      11             kjh         556
    12        hh         24                      12             fjk          751
    now i want the result in final table like below
    f1         f2       f3         f4         f5
    10        aa      11      abc      456
    10        aa      11      def       655
    10        aa      11      ghi       456
    10        aa      11      tre       455
    10        bb      15      abc      456
    10        bb      15      def       655
    10        bb      15      ghi       456
    10        bb      15      tre       455
    10        ff        13      abc      456
    10        ff        13      def      655
    10        ff        13      ghi      456
    10        ff        13      tre       455
    11        dd      16      ftr        256
    11        dd      16      kjh      556
    11        zz      24      ftr       256
    11        zz      24      kjh      556
    11        ii        54      ftr       256
    11        ii        54      kjh      556
    12        hh      24      fjk       751
    i can get this result using the
    Loop at itab.
    loop at itab1 where f1 = itab-f1.
    process....
    endloop.
    endloop.
    but it is very slow. i want to avoid this loop inside the loop and i want to implement the same program using read table.. like below..
    Loop at itab.
    Read table itab1 with key ....
    process...
    endloop.
    Is it possible? to get multiple records from itab2 using read statement or with READ statement that using CASE Statement or IF statemetnt.
    Plz help me...

    hi,
    please try the following code
    TYPES:
      begin of ty_itab2,
       f1
       f2
       f3
       f4
       f5
      end of ty_itab2.
    DATA:
      lw_tab2tmp type ty_itab2,
      lt_tab2tmp type standard table of ty_itab2.
    sort it_itab by f1.
    loop at it_itab into lw_itab.
      at new f1.
        CLEAR lt_tab2tmp[].
        loop at it_itab1 into lw_itab1 where f1 = lw_itab-f1.
          CLEAR lw_tab2tmp.
          move-corresponding lw_itab1 to lw_tab2tmp.
          append lw_tab2tmp into lt_tab2tmp.
        end loop.
        "while there is no data with f1 in it_itab1
        if lt_tab2tmp is initial.
          lw_tab2tmp-f1 = lw_itab-f1.
          append lw_tab2tmp into lt_tab2tmp.
        endif.
      end at.
      CLEAR lw_tab2tmp.
      MOVE-CORRESPONDING lw_itab to lw_tab2tmp.
      modify lt_tab2tmp from lw_tab2tmp TRANSPORTING f2 f3 where not f1 is initial.
      append lines of lt_tab2tmp into lt_itab2.
    end loop.
    lt_itab2 is the final table.
    There may be some syntactically errors.
    I have not a system to test it now, please test it.

  • Is it possible to insert an area inside my immage so that....

    Is it possible to make an area inside my immage so that when
    I export my document into dreamweaver, I can put what ever I want
    in that area.........like a table or another picture, code,
    etc?

    dm25 wrote:
    > Is it possible to make an area inside my immage so that
    when I export
    > my document into dreamweaver, I can put what ever I want
    in that
    > area.........like a table or another picture, code, etc?
    There is, but there's no guarantee the the result will be
    what you want.
    To do it, make sure there is a slice over the area you want
    to add
    things to, so that when you insert the FW HTML into your page
    in
    Dreamweaver, you can remove the image from the corresponding
    table cell
    and use it as the background image for the cell. The problem
    you are
    likely to run into is that any content you add to that cell
    will break
    the table.
    To put it simply, it's a bad idea.
    Linda Rathgeber [PVII] *Adobe Community Expert-Fireworks*
    http://www.projectseven.com
    Fireworks Newsgroup:
    news://forums.projectseven.com/fireworks/
    CSS Newsgroup: news://forums.projectseven.com/css/
    http://www.adobe.com/communities/experts/

  • Event controll: How to stop a running while loop inside a event structure

    Hello,
    I have some problems with controlling a while loop inside a event structure (see attached VI).
    I habe 3 buttons ("Start Measurement, Stop Measurement, Quit Program"). When a measurement is running, it should be possible to stop the measurement by clicking on "Stop Measurement", but this does not work.
    Has anyone an idea?
    Thanks a lot and best regards,
    Michael
    Message Edited by MichaGue_01 on 04-23-2010 04:37 AM
    Solved!
    Go to Solution.
    Attachments:
    Event_Controll.vi ‏27 KB

    Hello,
    Try not to use while loops inside a Event structure.
    My approach is using two While loops (one will have only the Event structure).
    I had to use to Flag buttons that make it a bit more complicated but i am sure somebody will come up with a better idea, or you might want to have a think about it yourself.
    Have a look on the modified version on the attachment.
    Once you are happy how it works then you can Hide the 2 flag buttons from the Front Pannel by going to Block diagram right-click the indicators and choose option "Hide Indicators/Controls"
    I did it in LV 8.6 so i hope you can open it on your PC if not i can downgrade it.
    If you have any problem let us know.
    Regards
    Dimitrios
    Test Systems Computing Engineer
    Cummins Turbo-Technologies
    Attachments:
    Event_Controll[1]_modified.vi ‏18 KB

  • Can't we use while loop inside a fn

    i am using a while loop inside a fn
    it is showing error
    the code is
    while (a=1) loop
    some condition
    end loop;
    the error is
    PLS-00103: Encountered the symbol "WHILE" when expecting one of
    the following:
    * & = - + < / > at in is mod not rem then <an exponent (**)>
    <> or != or ~= >= <= <> and or like between overlaps || year
    DAY_
    The symbol "*" was substituted for "WHILE" to continue.
    PLS-00103: Encountered the symbol "LOOP" when expecting one of
    the following:
    . ( * % & = - + < / > at in is mod not rem then
    <an exponent (**)> <> or != or ~= >= <= <> and or like
    between ||
    what is the error

    It looks like the OP misskeyed the assignment operator and got compilations errors, and from that assumed that you can't use WHILE loops in functions on a Tuesday.
    Message was edited by:
    William Robertson
    I was thinking of his is it possible to increment a value in a function, though I suspect the problem is similar.

  • While loop inside a timed loop

    Hi everybody!
       I'm using:
           - LV 7.1 + RealTime;
           - compactFieldpoint;
       I've noticed a strange behaviour, when I put a while loop inside a timed loop.  Let's fix timed loop with these settings:
           - 1 KHz clock
           - 1 ms period (yes, I know it's short....)
           - offset 0 ms
           - Phase 0
           - Discard missed period (ON) and MAintain original Phase (ON);
           - Timeout: -1.
       If inside this loo, I put a traditional while loop, waiting (say) for an event to occur, and if this event does not arrive, my cFP-2020 hangs! I mean, it becomes unreachable for the debugger, and, more, if I run a ping to it's address, after some cycles it becomes unreachable also from ping!
       Clearly, this code statement lock the fieldPoint, because if I remove the inner while loop all works.
      I know that with 1 ms period, timed loop always finishes late, but I set to discard missed period and timeout to -1. 
       It seems to me that sometimes Timed Loop add heavi overhead to programs, I'm turning to all while loop based tasks, even if my application has to be real-time!
       Advices welcomed! Have a nice day!
    graziano
    Solved!
    Go to Solution.

    I think the issue here is that putting your while loop inside a Timed Loop increases the priority for that task. Timed Loops can have dynamic priorities set over eachother, but they all run between Above Normal and Time Critical priority. My guess is that the debugger and built-in TCP functions run at Above Normal priority or less. This means your cFP isn't hanging, it's doing what it thinks is best. It's trying to finish this task before handling any lower-priority tasks.
    The suggestion to put a Wait function in your loop is an OK one. Keep in mind that you can actually set your wait time to zero instead of one and get the same positive benefit of handling other tasks. I would also suggest that you might look into waiting for this event in a lower priority (non-Timed) loop, and then transmit the appropriate data to your Timed Loop using an RT-FIFO or something. That might give you better handling. Just a thought....
    Jarrod S.
    National Instruments

  • For loop inside  a while loop, what order is that in big o??

    If say I have a for loop inside a while loop, then is that suppose to be in the order of O(n^2) right?? Is there any possibilities to change this into the order of O(n)??

    the other size and the temp size is abstact, which can be defined. This is actually for my union method, my teacher asks me to write this method using the order of O(n) which I think it is not possible. What do you guys think??
    Below is the code I have made:
    public Set<E> union(Set<E> other) {
              int count = 0;
              Iterator<E> iterator1 = other.iterator();
              while (iterator1.hasNext())
                   count++;
              Object[] temp = new Object [data.length+count];
              n = data.length+count;
              for (int i = 0; i<count; i++)
                   temp[i] = data;
              for (int j = count; j<temp.length; j++)
                   temp[j] = iterator1.next();
              data = temp;
              return null;
    but it still has same elements on it and I am thinking of a way on how to remove those same elements

  • The demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.

    the demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.
    your recommended second option that i could add true/false case.
    this true/false case must be inside the for loop or outside the for loop?if this case is inside the for
    loop, how can i send stop command from outer while
    loop?
    more over do you have any example for this please?
    thanks"

    You can execute a fixed number of iterations using a while loop by comparing the iteration count to the number of iterations you want and wiring the output of that comparison (e.g. Less Than or Equal To) to the continue (or stop) terminal of your while loop. Which comparison you use depends on personal preference, where you wire the desired count and the interation count, and whether you're using the while loop as Continue if True or Stop if True.
    Ben gave you step-by-step instructions in response to your previous question. Look here for Ben's response.
    Ben's response looks pretty good and detailed to me. It certa
    inly deserved better than a 1-star rating.

  • Is it possible to put my MacPro HD into my G5 drive bay?

    Hi All,
    I have a Dual 2.3 GHz G5 tower at home and a Dual-Core Intel Xenon 2.66 GHz in my office. I'm trying to troubleshoot my office HD and wanted to work on it at home. Is it possible to put my office HD into the spare drive bay in my home machine?
    Really all I want to do is use SuperDuper to make a clone of my office drive, but it takes like 5 hours to complete this task and was hoping to set it up before going to bed and having it finished when I wake up. Any advice would be much appreciated.

    You must be trying to use USB2 if it takes 5 hrs, or you have 500GB of actual data.
    Instead of popping it inside I'd just get a FW800 case or kit for easy connection.
    It might be best to run Disk Warrior (4.1.1+) or maybe address what/why it needs troubleshooting. But I would never rely on or trust Apple DU First Aid to diagnose a hard drive, let alone fix any problem.

Maybe you are looking for