ABAP loop inside eCATT
Hello Colleagues,
I want to read multiple values from a table and display for which i going thru an loop .
But to display it is becoming an problem can you kindly see the code below .
Am trying to store the table fields in an table as mentioend below in the ABAP ENDABAP code.
V_C3[]-TABLE_LINE = <fs_field>.
But i am getting an error while compiling the code.
Can you suggest the solution for the same ?
loop at <fs_itab> assigning <fs_wa>.
assign component 'CLIENT' of structure <fs_wa> to <fs_field>.
V_CLIENT = <fs_field>.
assign component 'C0' of structure <fs_wa> to <fs_field>.
V_C0 = <fs_field>.
assign component 'C1' of structure <fs_wa> to <fs_field>.
V_C1 = <fs_field>.
assign component 'C2' of structure <fs_wa> to <fs_field>.
V_C2 = <fs_field>.
assign component 'C3' of structure <fs_wa> to <fs_field>.
V_C3[]-TABLE_LINE = <fs_field>.
assign component 'C4' of structure <fs_wa> to <fs_field>.
V_C4 = <fs_field>.
assign component 'C5' of structure <fs_wa> to <fs_field>.
V_C5 = <fs_field>.
assign component 'C6' of structure <fs_wa> to <fs_field>.
V_C6 = <fs_field>.
assign component 'C7' of structure <fs_wa> to <fs_field>.
V_C7 = <fs_field>.
assign component 'C8' of structure <fs_wa> to <fs_field>.
V_C8 = <fs_field>.
assign component 'MESSAGE_ID' of structure <fs_wa> to <fs_field>.
V_MESSAGE_ID = <fs_field>.
assign component 'TIMESTAMP' of structure <fs_wa> to <fs_field>.
V_TIMESTAMP = <fs_field>.
assign component 'EXTRACTKEY' of structure <fs_wa> to <fs_field>.
V_EXTRACTKEY = <fs_field>.
assign component 'STATEID' of structure <fs_wa> to <fs_field>.
V_STATEID = <fs_field>.
assign component 'DEVICE_ID' of structure <fs_wa> to <fs_field>.
V_DEVICE_ID = <fs_field>.
ENDLOOP.
regards
harsha
Hello Harsha,
This task can be performed in more simpler way if i understand your requirements correctly.
Inside ABAP ... ENDABAP statements use Select statement and read all the values from your target table and assign it to a Local variable of the same table type.
Note : Import & Export variables cannot be used inside the ABAP ... ENDABAP statement.
Once all the values are stored in the Local table , outside the ENDABAP statement you can assign directly to the Export variable of table type with the local variable.
This export variable becomes visible outside the script asusual.
This should solve your requirment.
Thanks & Best regards,
Ajay
Similar Messages
-
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. -
Hi guru's in ABAP loop with in the loop is possible
hi guru's in ABAP loop with in the loop is possible
Hi sri,
it is posible clearly.
see this code.
data: t_spfli type table of spfli with header line,
t_sflight type table of sflight with header line.
select * from spfli into table t_spfli.
select * from sflight into table t_sflight.
loop at t_spfli.
write:/ t_spfli-carrid,
t_spfli-connid.
loop at t_sfplight where carrid eq t_spfli-carrid
and connid eq t_spfli-connid.
write / t_sflight-fldate.
endloop.
endloop.
Plz Reward if useful,
Mahi.
Message was edited by:
Maheswari Chegu -
i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks
Hi fais,
Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
You can replace the inner for loop with a while by doing the following.
1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
2) Make sure the tunnels you where indexing on with the for loop are still indexing.
3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
4) Wire the output of the array size into the new while loop.
5) Set the condition terminal to "stop if true".
6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
7) C
reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
8) Drop a "less than" node inside the inner while loop.
9) Wire your iteration count into the bottom input of the "less than".
10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
I will let others explain how to takle this task using the "case solution".
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
I have a while loop (outside) and a for loop (inside) and a control button within the for loop. I want to stop the program by click the botton without finishing the for loop. How can I do that?
Thank you in advance.HI Please find attached snapshot Regards, Santosh
Message Edited by SanRac on 12-17-2009 05:12 AM
Message Edited by SanRac on 12-17-2009 05:13 AM
Attachments:
Snap1.png 4 KB -
Loop Inside loop, time out error.
Pls look into the below code, In this im looping inside a loop.
Im looping thru the internal table( say 2000 records ) which has data from a select query, inside this loop i need to calculate the total of output qty which is available in the another VIEW/TABLE which might return 10 records in each iteration of the inner loop.
This process takes huge time to process also gives out runtime out error.
pls help.
LOOP AT itablnpln INTO walnpln.
contot = 0.
This particular query loop takes large time to process
SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp
FROM zvprdconf where aufnr = walnpln-aufnr and
j_3asize = walnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.
IF sy-subrc EQ 0.
*Earlier i used this looping.
*loop at itablnp into walnp.
contot = contot + walnp-J_3ALMNGA.
move walnp-J_3ASIZE to walnpln-J_3ASIZE.
endloop.
*Currently tried with the following,
LOOP AT itablnp ASSIGNING <fs_itablnp>.
contot = contot + <fs_itablnp>-J_3ALMNGA.
move <fs_itablnp>-J_3ASIZE to walnpln-J_3ASIZE.
ENDLOOP.
walnpln-output = contot.
move zvprdconf-isdd to walnpln-zdate.
move zvprdconf-isdz to walnpln-ztime.
endif.
ENDLOOP.
regs,
RajaDear Naresh,
Even after changing the code as below, i m getting the same error.pls help.
IF SY-SUBRC = 0.
SORT ITABLNPLN.
DELETE ADJACENT DUPLICATE FROM ITABLNPLN COMPARING ALL FIELDS.
ENDIF.
pls find the complete code as below.
code]
*& Report SAPMZLINEPLANRPT
INCLUDE ZLPR_TOP.
*Event AT Selection-Screen on Block Param.
AT SELECTION-SCREEN ON BLOCK sorter.
CHECK All = 'X'.
*Event Start-Of-Selection.
START-OF-SELECTION.
Data: zstat type jest-stat.
data: stklocaf type mska-lgort.
data: stklocas type mska-lgort.
FIELD-SYMBOLS <fs_itablnp> LIKE LINE OF itablnp.
CLEAR it_ZVPRODDET.
SELECT DISTINCT ZVPODbukrs ZVPODaufnr ZVPOD~objnr
jeststat ZVPODwerks ZVPODarbpl ZVPODJ_3AKORD2
zvpodplnbez zvpodaufnr zvpodkdauf zvpodkdpos
zvpodj_3akord1 zvpodj_3akord2 zvpod~j_3akordx
zvpodj_3absnr zvpodmatnr zvpod~j_4kscat
zvpodmvgr4 zvpodj_3acada zvpodj_4krcat zvpodmenge
zvpodposnr zvpodkunnr zvpodaufpl zvpodaplzl
zvpodplnnr zvpodarbid zvpodsteus zvpodbismt
zvpodwerks zvpodj_3akvgr6 zvpod~j_3arqda
zvpodmvgr5 zvpodaudat zvpod~j_3addat
zvpodvtweg zvpodobjnr zvpod~bukrs
zvpodfsavd zvpodssavd zvpod~bstkd
zvpodbstdk zvpodihrez zvpod~bstkd_e
zvpodbstdk_e zvpodihrez_e zvpod~arbpl
zvpodvgw01 zvpodkvgr2 zvpod~vsart
FROM ZVPOD
INNER JOIN jest ON ZVPODobjnr = jestobjnr
INTO CORRESPONDING FIELDS OF table it_ZVPRODDET where
plnbez in FGM and arbpl in wc and werks in plant
and SSAVD in eldate
and J_3AKORD2 in cups and jest~inact ne 'X'.
SORT it_ZVPRODDET BY aufnr stat.
LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.
IF wa_ZVPRODDET-stat = 'I0045' . " TECO - compl
DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
ELSEIF wa_ZVPRODDET-stat = 'I0009' . " CNF - Confirmed
DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
ELSEIF wa_ZVPRODDET-stat = 'I0012' . " DLV - Delivered
DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
ELSEIF wa_ZVPRODDET-stat = 'I0046' . " CLSD - Closed
DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
ELSEIF wa_ZVPRODDET-stat = 'I0076' . " DLFL - Del Flag
DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
ELSEIF wa_ZVPRODDET-stat = 'E0003' . " SCLS - Short Close
CLEAR tj30t.
SELECT SINGLE txt04
FROM tj30t INTO tj30t-txt04
WHERE stsma = 'PRDHOLD' AND
estat = 'E0003' AND
txt04 = 'SCLS' AND
spras = 'EN'.
IF sy-subrc = 0.
DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
ENDIF.
ENDIF.
Condition for Prod Order released - REL
IF wa_ZVPRODDET-stat = 'I0002'.
mreleased = 'Y'.
else.
mreleased = 'N'.
endif.
zstat = wa_ZVPRODDET-stat.
IF mreleased = 'N'.
DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr
and stat = zstat.
ENDIF.
ENDLOOP.
case mark.
when All.
LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.
zaufnr = wa_zvproddet-aufnr.
zarbid = wa_zvproddet-arbid.
move wa_zvproddet to walnpln.
append walnpln to itablnpln.
endloop.
clear walnpln.
if not itablnpln is initial.
SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp
FROM zvprdconf FOR ALL ENTRIES IN itablnpln
where aufnr = itablnpln-aufnr and
j_3asize = itablnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.
if sy-subrc = 0.
sort itablnpln by aufnr j_3asize.
DELETE ADJACENT DUPLICATES FROM ITABLNPLN COMPARING ALL FIELDS.
endif.
endif.
LOOP AT itablnpln INTO walnpln.
contot = 0.
IF sy-subrc EQ 0.
LOOP AT itablnp ASSIGNING <fs_itablnp> where aufnr = walnpln-aufnr and j_3asize = walnpln-j_3akordx.
contot = contot + <fs_itablnp>-J_3ALMNGA.
move <fs_itablnp>-J_3ASIZE to walnpln-J_3ASIZE.
ENDLOOP.
walnpln-output = contot.
move zvprdconf-isdd to walnpln-zdate.
move zvprdconf-isdz to walnpln-ztime.
endif.
walnpln-wip = walnpln-menge - contot.
if walnpln-werks = '1000'.
stklocaf = '1050'.
stklocas = '1060'.
elseif walnpln-werks = '2000'.
stklocaf = '2150'.
stklocas = '2160'.
endif.
select single kunnr into walnpln-ship from vbpa where
vbeln = walnpln-KDAUF and PARVW = 'WE'.
zship = walnpln-ship.
move zship to walnpln-ship.
select single kalab into walnpln-zactqty from mska
where matnr = walnpln-plnbez
and j_3asize = walnpln-J_3AKORDX and LGORT = stklocaf.
condense walnpln-kdauf.
zsales = walnpln-kdauf.
concatenate zsales 'S' into zso.
select single kalab into walnpln-zsndqty from mska
where matnr = walnpln-plnbez
and j_3asize = walnpln-J_3AKORDX and LGORT = stklocas
and J_4KSCAT = zso.
zmatn = walnpln-plnbez.
zsale = walnpln-KDAUF.
walnpln-kdauf = zsale.
walnpln-plnbez = zmatn.
zcust = walnpln-kunnr.
walnpln-kunnr = zcust.
select single bezei into walnpln-season from TVV2T where
kvgr2 = walnpln-kvgr2 and SPRAS = 'E'.
select single bezei into walnpln-shipmode from T173T where
vsart = walnpln-vsart and SPRAS = 'E'.
STRL = strlen( walnpln-j_3akord2 ).
if strl = 4.
move walnpln-j_3akord2 to walnpln-j_3akord3.
clear walnpln-j_3akord2.
endif.
move zremk to walnpln-remk.
MODIFY itablnpln FROM walnpln.
contot = 0.
clear itablnp.
ENDLOOP.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
endcase.
[/code]
regs,
raja[ -
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. -
HI
HOW TO WRITE ABAP CODE IN ECATT TESTING FOR IF VENDORNO DOES NOT EXIST IT SHOULD NOT DISPLAY THE VENDOR SCREEN.
PLZ HELP ME I WILL BE THANKFULI wouldn't use ABAP for this (always remember that using inline ABAP reduces the readability of your script).
Instead, I would use the corresponding display transaction to attempt to display the vendor and use the MESSAGE...ENDMESSAGE construction in eCATT to catch any error messages that occur. With the MESSAGE command, you can specify that certain error messages - if they occur - should not cause the script to fail. -
Usage of for-each loop inside another for-each loop
Hi All,
I have tried using a for-each loop inside another for-each loop as given below.
<?for-each:G_1?>
<Customer Details>
<?for-each:G_2?>
<Address>
<?end for-each?>
<?end for-each?>
Its not getting inside the second loop.I have referred this link
Re: Loop Question but it didn't help me much.Please let me know if am going wrong somewhere.
Regards,
Sudeep.Sudeep,
The syntax of the for-each statements looks oke. but you have omitted some question marks after the < and before the >.
Furhermore, there cannot be spaces in XML element names. So, "Customer Details" won't work. Change it to something like: "Customer_Details". Also be reminded that the element names are case-sensitive.
try this:
<?for-each:G_1?>
<?Customer_Details?>
<?for-each:G_2?>
<?Address?>
<?end for-each?>
<?end for-each?>
Regards,
Kevin -
Simulation loop inside subVI inside a simulation loop
First of all, let me just say, I've got to hand in my work in 24 hours so please any help will be appreciated.
I've got a simulation loop inside a subVI inside a simulation loop. If I give the inner loop enough time to run, i.e make its duration smaller than the time step of the outer simulation loop. Shouldn't everything run smoothly? Or is this just a no-no with labview?
Thank youHi VicMackie,
This help file on the properties of the Simulation Loop is likely to help you out.
I believe from you posts that you're wanting the loop to run every second.
Therefore you want to check "Synchronize loop to timing source" and set your 1kHz clock or set a 1kHz <reset> so that it'll reset on every invocation of the loop. From your post, I understand that you've already done this.
As the period is in milliseconds, for a period of a second you'd want to set your period to 1000 milliseconds, which is the default (1000).
I'd recommend leaving the step size at the default for now and just modifying the Timing Parameters tab to confirm whether the loop will execute every second if you set the period to 1000.
Best wishes,
Tori
Student -
Help with loops inside a method
I am having a bunch of problems creating a loop inside my 'mean' method. What i want do is set up a loop to give me the average of the numbers of the input that i entered. Can anyone assist me in creating this loop?
My code:
import java.io.*;
import java.text.*;
import java.util.StringTokenizer;
public class Labtest6{
public static void main (String args []) throws IOException {
int MAX = 100;
int MIN = 0;
int [] list = new int [MAX];
int count = 0; // ammount of items//
double guess;
double x;
double avg;
double var;
double stdDev;
BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
NumberFormat nf = NumberFormat.getNumberInstance ();
nf.setMaximumFractionDigits (2);
nf.setMinimumFractionDigits (2);
count = read_list (list);
avg = mean (list, count);
System.out.println (count);
System.out.println (avg);
public static int read_list (int [] list)throws IOException {
BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
int count = 0;
String item = stdin.readLine ();
while (item != null)
list [count] = Integer.parseInt (item);
++ count;
item = stdin.readLine ();
return (count);
public static double mean (int [] list, double count) {
thanksThat's not our job. It is your homework. Once you have made an attempt at it and can't get it to work, paste your code and ask a specific question. You won't get any help if all you do is whine about how you can't do it.
P.S. When pasting code, highlight it and click the code button to retain formatting.
Message was edited by:
flounder -
LOOP inside FORALL in bulk binding
Can I use a loop inside forall in bulk bind updates?
as I understand, forall statement strictly loops through the length of the bulk limit size for the immediately following statement only.
I am attempting to use a loop there to update more than one table.
cursor c is select id from temp where dt_date > sysdate-30;
BEGIN
loop
fetch c into v_id;
limit 1000;
forall i in 1..v_id.count
UPDATE table_one set new_id = v_id(i);
exit when C%NOTFOUND;
end loop;
end;
I want to update another table table_two also immediately after updating table_one like this:
forall i in 1..v_id.count
UPDATE table_one set new_id = v_id(i);
BEGIN select nvl(code,'N/A') into v_code from T_CODES where ID_NO = v_id(i); EXCEPTION WHEN NO_DATA_FOUND v_code='N/A'; END;
UPDATE table_two set new_code =v_code;
exit when C% not found.
This is not working and when I run it, I get an error saying encountered BEGIN when one of the following is expected.
I got around this by having another FOR loop just to set up the values in another array variable and using that value in another second forall loop to update table_two.
Is there any way to do this multiple table udpates in bulkbinding under one forall loop that would enable to do some derivation/calculation if needed among variables [not array variables, regular datatype variables].
Can we have like
forall j in 1.. v_id.count
LOOP
update table 1;
derive values for updating table 2;
update table 2;
END LOOP;
Thank You.Well, without questioning reasions why do you want this, you are confusing bulk select and forall. You need:
begin
loop
fetch c bulk collect into v_id limit 1000;
exit when v_id.count = 0;
forall i in 1..v_id.count
UPDATE table_one set new_id = v_id(i);
end loop;
end;
/SY. -
Making .mov to loop inside flash
I have a seamless quicktime .mov of clouds I want to use as a background.
I set my flash animation to loop...but at the end of the .mov file instead of looping it just quits.
How do I get the quicktime .mov file to loop within flash?
Using Flash CS4Re: Loop inside a loop making performance poor!!!Yup, it probably will be.
Your nested loops have an advantage in that they give you control over the process of what is happening. Unfortunately due to several factors including context switching between pl/sql and the sql engine this process is all but certain to be slower than doing the work in SQL.
Instead of nested loops which call a procedure define a cursor directly your routine to get the data, then use a bulk collect - you can read about them in the documentation - to load your collection. One select with a bulk collect is all but certain to be faster than loading each row one item at a time. -
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 KBHello,
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 -
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.
Maybe you are looking for
-
Can iTunes show albums just once in list of albums?
For illustration purposes: If I have just one album in my library by a single artist: In Album grid view, I'd see one album cover as expected. If you double click the cover you'd see the list of songs in that album - all as expected. If you click lis
-
I understand that R in RICEF entails the development of custom reports. However, how do we go about testing the custom report? Do we need to go to each table/screen the and see if value is correct? Does it typically involve testing only a sample?
-
W520 CRASHES SSDs WHEN WAKING UP FROM SLEEP MODE
I bought a W520 about a year ago and have gone through 2 SSDs (new Crucial M4 256GB drives), each of which died when the machine was coming out of sleep mode. I had problems with the W520 not coming out of sleep mode properly since I receive it, but
-
Any plan for Pro*C to tolerate spaces in paths?
As of the most recent Pro*C downloaded for use with the Instant Client (11.2.something), it still can't tolerate spaces in any of its inputs. Since Visual Studio installs by default into C:\Program Files\Microsoft Visual Studio X\..., there's an imme
-
Ignition spark noise interference
Hi, My project involves using sensors to collect data in a shock tube that employs an automotive (>35kV, 175mJ of energy sparks) and capacitive discharge (2kV, 2Joules of energy arcs) ignition system to initiate combustion of fuel+O2. However, the si