Array loop - assigning variables
Hi All,
This is similar to a question I previously had, (which kglad so kindly helped me with) so please bare with me.
Here is the code:
nor = Array(a, b, c);
aVar = Array();
aVar[0] = 0;
aVar[1] = 0;
aVar[2] = 0;
for (i=0; i<nor.length; i++)
nor[i].onRelease = function() {
nor[i].ivar=i;
aVar[this.ivar] = 1;
trace(aVar[this.ivar]); // this outputs "1" //
for (i=0; i<nor.length; i++)
trace(aVar[i]); // this outputs "0, 0, 0" //
The problem is that when tracing the "aVar" array, one of them should be "1" (so I think)
Any Ideas?
Thank you
ahhhh... of course.
Thanks kglad. I really appreciate your help.
*I did revise the code slightly for future/others use.
nor = Array(a, b, c);
aVar = Array();
aVar[0] = 0;
aVar[1] = 0;
aVar[2] = 0;
for (i=0; i<nor.length; i++)
nor[i].ivar=i;
for (i=0; i<nor.length; i++)
nor[i].onRelease = function() {
aVar[this.ivar] = 1;
trace(aVar[this.ivar]); // this outputs "1" //
for (i=0; i<nor.length; i++)
trace(aVar[i]); // this outputs "0, 0, 0" //
Similar Messages
-
Assigning java script array to a variable in struts form class
Hi,
I am trying to send a javascript array of string from jsp to struts action form.
I have constructed a javascript array and assigned it to the form variable. But iam not able to access the variable in Action form. :( please let me know as to how i can send a string array in javascript to action form?.
JavaScript
var scriptarray = new Array();
// code for populating the array
document.MyForm.javaArray = scriptArray;
document.MyForm.action="MyAction.do?dispatch=handlerMethod";
document.MyForm.submit();var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "bla..bla");
input.setAttribute("value", "bla..bla");And in addition to that.. Google is still alive -
Put loop of variables into single array with formatting (PHP)
I have the following loop;
<?php
$i=1;
while($i<=$num_rows)
$tempquantity = "extra".$i."quantity";
$tempcomments = "extra".$i."comments";
$tempname = "extra".$i."name";
$tempprice = "extra".$i."price";
$$tempquantity = $_POST['extra' . $i . 'quantity'];
$$tempcomments = $_POST['extra' . $i . 'comments'];
$$tempname = $_POST['extra' . $i . 'name'];
$$tempprice = $_POST['extra' . $i . 'price'];
print "Extra name: " . $$tempname;
print "<br />";
print "Extra price: " . $$tempprice;
print "<br />";
print "Quantity required: " . $$tempquantity;
print "<br />";
print "Client comments: " . $$tempcomments;
print "<br /><br />";
$i++;
?>
Which, since there are 3 rows, outputs the following;
Extra name: dfvgfddf
Extra price: 4
Quantity required: 67
Client comments: gtfh
Extra name: wewew
Extra price: 34
Quantity required: 45
Client comments: thtrt
Extra name: ewewe
Extra price: 43
Quantity required: 12
Client comments: gdfgg
What I want to be able to do is show the output above in a PHP email body variable, which I think this means that the loop of varaibles needs to be in one single array variable since coding in an email body variable is not allowed. How do I put a loop of variables like this into a single variable, and how to I keep the <br /> tags and names in front of the varaibles ('Extra name:' etc), so it looks as it should in the PHP email body?
Thanks in advanceHi Murray,
This is the code that sends the email;
$to = "$renteremail";
$subject = "Request confirmation";
$headers = "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: website";
$body = "
Your reference number is <strong>$rrnumber</strong>.
<br />
<br />
Below is a summary of your request details;
<br /><br /><strong>Accommodation name</strong>: $accomm_name
<br /><strong>Accommodation type</strong>: $accomm_type
<br /><strong>Board-type</strong>: $ptbt
<br /><strong>Max. capacity</strong>: $ptc
<br /><strong>Check-in date</strong>: $passdate
<br /><strong>Number of nights</strong>: $passnights
<br /><br /><strong>Renter's name</strong>: $rentername
if (mail($to, $subject, $body, $headers)) {$messagesent = 'yes';}
So the three loop items with their four respective variables should go at the end of the list of variables above after 'Renters name'.
I also need to put the variables generated by the loop into a single database feild, so if possible all should go into one variable.
Thanks -
How to create an array containing shared variable values
Hi
I am trying to programmatically create an array containing shared variable values and their names. I can get the variable names by supplying the process name to the get shared variable list function. How do I then read the value of all the shared variable items returned?
I have used a data socket open to open a connection to all variables when my program starts. I then use datasocket read on the opened connections to write to an array. This works fine until I try to write to one of the variables using a shared variable node. The variables writes can take from 4secs to 2 mins. When I remove the shared variable node again all is fine. Also when I stop using the data sockets, all is fine.
Is there a conflict between shared variable nodes and data socket writes to the shared variables?
Can anyone help? I cannot easily post example code because I am reading the variables from a Wago PFC (PLC) using OPC.Hi
Sorry I forgot to mention the LabVIEW version, its 8.20. I have tried saving the shared variable node as a sub VI and it makes no difference.
Attached is a stripped down version of the software. You will not be able to connect to the IO server because it requires some Wago hardware and software. You may spot something I have done wrong with the I/O servers, variables or sub VI's.
The main program that runs is called 'HMI Engine' in the 'Framework' folder. There may be some other things in the project that aren't used in this example. I have removed all but the variable connection part of the code.
I hope someone can help!?
Thanks
Mark.
Attachments:
HMI Test.zip 144 KB -
Using an array to assign movie clips to buttons
Thanks in advance for any help you can give me!!
I've got 5 movie clip buttons. When a user rolls over a button, I want one movie clip to play. When a user clicks on that button, an alternate movie clip plays. I'm trying to use an array to assign certain movie clips to certain buttons and actions, but I'm not doing something quite right. I can get one button to work correctly, but then am having issues getting the other buttons to work.
Here is the code I have:
var currentPage:MovieClip;
var currentScreen:MovieClip;
var prevPage:MovieClip;
var currentButton:MovieClip;
var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
{button:m2_mcButton, page:m2_mc, screen:s2_mc}]
for(var i=0;i<arrNavigation.length;i++){
arrNavigation[i].button.buttonMode=true;
arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
function onButtonOver(e:MouseEvent):void
for(i=0;i<arrNavigation.length;i++) {
if(arrNavigation[i].button == e.currentTarget)
currentPage = arrNavigation[i].page;
currentPage.gotoAndStop("over");
function onButtonOut(e:MouseEvent):void{
currentPage.gotoAndStop("out");
function onButtonClick(e:MouseEvent):void{
for(i=0;i<arrNavigation.length;i++) {
if(arrNavigation[i].button == e.currentTarget)
currentScreen = arrNavigation[i].screen;
arrNavigation[i].screen.gotoAndPlay("over");if your buttons are movieclips, use:
var currentPage:MovieClip;
var currentScreen:MovieClip;
var prevPage:MovieClip;
var currentButton:MovieClip;
var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
{button:m2_mcButton, page:m2_mc, screen:s2_mc}]
for(var i=0;i<arrNavigation.length;i++){
arrNavigation[i].button.buttonMode=true;
arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
arrNavigation[i].button.ivar=i;
function onButtonOver(e:MouseEvent):void
currentPage = arrNavigation[e.currentTarget.ivar].page;
currentPage.gotoAndStop("over");
function onButtonOut(e:MouseEvent):void{
currentPage.gotoAndStop("out");
function onButtonClick(e:MouseEvent):void{
currentScreen = arrNavigation[e.currentTarget.ivar].screen;
currentScreen.gotoAndPlay("over"); -
Garbage Collection facilitation by assigning variables to null
Hello,
I understand Garbage Collection (GC) can be facilitated by assigning variables to null. Is this true for all variables?
I have a class and there are some member variables which are strings. Also i have some methods with some string variables declared and defined inside the method. I am assigning null to class member variables and also the string variables of the method.
is it correct to assign null and faciliate GC for the string variables declared and defined inside the method?
Class A {
String t1;
public void test() {
String t2 = "test";
// processing
t2 = null; // Will this facilitate GC?
public static void main (String[] args) {
test();
A obj = new A();
A.t1 = "testclass";
A.t1 = null; // Will this faciliate GC?
Thanks, AravinthIn fact, the java heap is divided into a space for new allocations, and two survivor spaces. The algorithm for when collection occurs in each space is complex, and tuning GC is an interesting topic all its own. Follow the best advice you have been given ... chillax. The JVM has GC under control.
<think/> Of course, having said this, you can have memory leaks if you create references that never go out of scope, even if they are no longer used. Avoid this.
� {� -
Excel Sheet Looping: For each loop from variable Enumerator
Hi,
Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
Also,
I have an excel file with 10 sheets, but want to loop only 5 sheets. Please help..how can i achieve this.
Actually i tried with
1> stored the 5 sheets name into a variable (say 'SheetsName') of type string using script task
2> For each loop container
enumerator - 'For each ADO Schema Rowset enumerator'
connection: ADO
schema: 'Tables'
variable mapping: 'User::SheetsName'
3> Within For each loop container added a data flow task
4> Inside DFT - excel source -
Data access Mode: 'Table Name or view name variable'
Variable Name: 'SheetsName'
but this loops through all the 10 sheets irrespective of only 5 sheets names stored in the variable "SheetsName".
Please help...
Please Mark as Answer if my post solved your problem or Vote As Helpful if this helps. Blogs: www.sqlserver2005forum.blogspot.com>> Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
I don't think so. To loop through all worksheets of Excel For ADO.NET Schema Rowset Enumerator is the only option.
Please refer:
https://msdn.microsoft.com/en-us/library/ms345182(v=sql.110).aspx
>> I have an excel file with 10 sheets, but want to loop only 5 sheets
So you have configured For Each loop container which loops throgh all sheets and returns you sheet name to variable "SheetName".
Drag and drop one Sequence Container inside ForEach Loop Container and connect it to Data Flow Task.
Right click on connector and use expression: (which will check if current sheet is one of 5 required sheets)
@User::SheetName == "FirstSheet" || @User::SheetName == "SecondSheet" || .....
Below blog demonstrates kind of simillar steps:
http://www.bidn.com/blogs/MikeDavis/ssis/559/ssis-skip-certain-files-in-a-for-each-loop
-Vaibhav Chaudhari -
Hi everybody,
I'm writting a procedure and I want to assign to some variable, a value taken fron a cursor. I have 20 variables , and it could be more, that's why I want to do that within a loop.
I tried the following:
DECLARE CURSOR retrieve_salary IS
(SELECT ID, SALARY FROM TABLE ORDER BY ID);
retrieve_salary_row retrieve_salary%ROWTYPE
ID_1 NUMBER;
ID_2 NUMBER; .........
SALARY1 NUMBER;
SALARY2 NUMBER; .....
i NUMER;
BEGIN
OPEN retrieve_salary;
i:=1;
WHILE i < 3 --or te number of variable you have to assign
LOOP
FETCH retrieve_salary INTO retrieve_salary_row;
ID_||i := retrieve_salary_row.ID;
SALARY||i := retrieve_salary_row.salary;
i:=i+1;
END LOOP;
END;
this code doens't work because of the concatenation........is there a way to do that smartly?
Thanks in advance....
AlexHi,
If you want to store table data in different variables then why you are approaching to VARRAY or Assiciative Array. e.g.
"afiedt.buf" 17 lines, 399 characters
1 DECLARE
2 CURSOR emp_cur
3 IS SELECT ename,sal FROM emp WHERE rownum <=3;
4 TYPE emp_type is TABLE OF emp_cur%ROWTYPE
5 INDEX BY BINARY_INTEGER;
6 arr_var emp_type;
7 i NUMBER :=0;
8 BEGIN
9 OPEN emp_cur;
10 LOOP
11 i := i + 1;
12 FETCH emp_cur INTO arr_var(i).ename,arr_var(i).sal ;
13 EXIT WHEN emp_cur%NOTFOUND;
14 DBMS_OUTPUT.PUT_LINE('Name :'||arr_var(i).ename||' Sal :'||arr_var(i).sal);
15 END LOOP;
16* END;
SQL>/
Name :SMITH Sal :800
Name :ALLEN Sal :1600
Name :WARD Sal :1250
PL/SQL procedure successfully completed.
SQL>Regards
Avinash -
Problem in assigning script array to Js variable
There is a huge list(20,000) of cities that has to be put into a script array for the further use in the jsp page. so this script array is created once for all when the login is made for the application and stored a session variable. The sample of the script array is like-----
<script>
strArrCityName[17463]= "Zoar";
strArrCityID[17463]= "10599";
strArrCityStateID[17463]= "3";
strArrCityName[17464]= "Zoarville";
strArrCityID[17464]= "10600";
strArrCityStateID[17464]= "3";
</script>
the entire stuff from <script>---</script>(uncluding the script tags is stored as a string in the session (strSessionCityArr))
Now the porblem is i need to store this array into a js variable on jsp page load.
I order to that i need to declare a js variable in jsp page
ex::
<html>
<body>
This is a sample jsp page created by <%= strUserName%>
<script>
var cityarry = "<%=session.getAttribute('strSessionCityArr')%>";
</script>
</body>
</html>
when i assign the array to the js variable , the <script> tag inside the string is conflicting with the <script> tag that of the jsp page.
This throws the js error and the futher loading of the page is stopped.
The reason i am storing it in the js variable is i will be painting the script array dyanamically on click of a button.
Also in need both the script tags in the array is in other jsp pages i will painting the array on page load by using the out.println(strCityArray)
I need a way in which this script array can be stored in js variable or any method by which i can directly get it from the session on button click
Thanx in advance
Manui had tired constructing the script array using the JS but JS logic is always slower ...my point was not to do it all with JS code. My point was that unless you know how to properly define it as JS-only code, then it makes it hard to figure out how to break that up to Java generated code. It's clear to me that you don't have a very good grasp of what you're trying to do.
The second point is, in some JSPs i need the <script> tags to be included in the array. No they don't. You can always put the <script> tags around what your Java variable includes if you are using that content in several places...
<script><%= session.getAttribute('strSessionCityArr') %></script> -
Dynamically assigning variable in xml loop
I am trying to dynamically assign a variable name so I can
build an accordian nav from and XML doc. the code looks like this:
ACnav['depthChild0']._alpha = 0;
ACnav.setStyle("color", 0x0ffffff);
ACnav.setStyle ("openEasing",
mx.transitions.easing.strong.easeout);
ACnav.setStyle ("selectionDuration",
mx.transitions.duration.slow);
navXML = new XML();
navXML.ignoreWhite = true;
navXML.load("menu1.xml");
oY=5;
var currentSection = 0;
function buildNav () {
DisposableXML = new XML();
TempXML = new XML();
button = new Array();
//buttonNum = new Array();
subitem = new Array();
menuItem = new Array();
o = new Array ();
subitemlocation = new Array();
DisposableList = new Array();
buttonList = navXML.firstChild.childNodes;
i = 0;
sectionLength = buttonList.length;
while (i<=buttonList.length) {
if (buttonList
.nodeName.toLowerCase() == "button") {
DisposableXML = buttonList;
DisposableList = DisposableXML.childNodes;
buttonName = buttonList
.attributes.name;
set ("buttonNum", "buttonNumber"+i);
trace(buttonNum);
ii = 0;
//trace(buttonName+"-"+buttonNum);
//ACnav.createChild("View", buttonNum, {label: buttonName,
icon: "mainNav"});
button = ACnav.createChild("View", buttonNum, {label:
buttonName, icon: "mainNav"});
oY=5
while (ii<=DisposableList.length) {
TempXML = DisposableList[ii];
if (DisposableList[ii].nodeName.toLowerCase() == "subitem")
subitem = TempXML.attributes.name;
//subitemlocation = TempXML.attributes.location;
subitemNum="subitemNum"+[ii]+
//trace(buttonNum+"-"+subitemNum+"-"+subitem);
menuItem = ACnav.buttonNum.createChild("subNav",
subitemNum, {childText: subitem});
menuItem
.move(0, oY);
oY=(oY+25);
//trace(buttonNum);
ii = Number(ii)+1;
i = Number(i)+1;
//trace(button);
trace(menuItem);
redraw();
//gotoAndPlay('reload');
The problem lies with this line: button =
ACnav.createChild("View", buttonNum, {label: buttonName, icon:
"mainNav"});
If I quote the "buttonNum", it works, but jumbles the subnav
items together vs in the proper node. I need to have that declared
dynamically so that each parent node has a differentID and then
createchild goes under that. Anyway, I've tried alot of stuff over
the last few days and its getting frustrating.
Thanks for the help if anyone contributes!You shouldn't need to do a concat within the XQuery path parameter. Try the following:
bpws:getVariableData('inputVariable','payload','/ns1:Request/ns1:instance[bpws:getVariableData("j")]') -
Array loop to change variables?
The plan is to set up variables to react to a flashvars value like this:
[code=html]<param name="flashvars" value="mainVars=1" />[/code]
[code=actionscript]
var videoArray:Array;
var videoTitle:String;
var videoFile:String;
videoArray=[0,1];
function onEnterFrame(){
for(var i=videoArray.length-1;i>0;i++){
while(i==_root.mainVar-1){
if(i==0){
videoTitle="Show the video's change";
videoFile="VID";
else if(i==1){
videoTitle="This is the second one";
videoFile="promo";
[/code]
There would be many mainVars (over 100, actually) and this setup isn't working. Could someone please help fix this problem?
Message was edited by: shawn234Oops, the mainVars was a typo.
What I want to have as the finished product is a video page of multiple video players, each player with a different mainVar value. The mainVar would tell the videoArray what to change the simplified videoTitle and videoFile variables to.
That's the plan. I don't know how to impliment it. I figured an array would be a good choice since the array can have infinite "i" values, but I could be horribly wrong... -
Order array by object variable
Hello !
I have an array which I'm looping through to get variables(as text) to display in dynamic text fields..
If possible I would like to sort the array into numeric order using "sTabArray[i].sHour". A variable of each of the array items..
Is there a way I can do this ? Maybe create a new array from the original one and then use that ??
for(i = 0; i < sTabArray.length; i++) {
var sMin:String = sTabArray[i].sMin;
var fMin:String = sTabArray[i].fMin;
var table_number:String = sTabArray[i].table_number;
var salle_number:String = sTabArray[i].salle_number;
printBox["horaires" + i].text = sTabArray[i].sHour + ":" + sMin + " à " + sTabArray[i].fHour + ":" + fMin;
printBox["evenement" + i].text = sTabArray[i].titre;
printBox["salle" + i].text = salle_number;
printBox["table_no" + i].text = table_number;
Many thanks in advance for you help
MartinsortOn
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html#sortOn%28%29 -
Using an array to assign values to 36 radio buttons
Okay, here's another doozy for y'all.
As some of you know, I'm trying to create a character creation program for D&D. When we roll ability scores, we roll 3 sets of 6 rolls, rolling 4 six-sided dice, rerolling 1s and dropping the lowest number, then add the highest 3 rolled numbers together.
Great! Got that part done!
The next thing I'm having some issues with is transferring those numbers to radio button text property. What I have done is created a form that has the rolled values in listboxes so the user can see what was rolled. They can only choose one "set"
of rolls, so each set of 6 rolls is in a separate listbox. I can get the values from the listbox to an array, but I can't figure out how to get the values from an array to the radio buttons on the next form in the program.
The next form in the program has 6 group boxes, each labeled with a different ability score name (ie: Strength, Dexterity, etc.). Also in each group box are 6 radio buttons. Each radio button in each group box needs to have the same values. For example,
the first listed radio button in each group box needs to have the first value listed in the list box on the previous page. The second listed radio button in each group box needs to have the second value listed in the list box, and so on. I want it
to automatically load, but I'll settle for ANY load at the moment!
The other thing is that I don't want to write 36 lines of code for each group box's radio buttons! I would like to be able to populate the values with a loop. So, the biggest question is how to create an array containing all 36 radio buttons, then assign
my list box values to them according to their position in the multidimensional array.
Here is a tidbit so you'll have an idea what I'm looking at.
list box 1 has values 17, 18, 8, 12, 15, and 13. I want the radio buttons in each group box on the second form to be 17 for the 1st radio button, 18 for the 2nd radio button, 8 for the 3rd radio button, 12 for the 4th radio button, 15 for the 5th radio
button, and 13 for the 6th radio button.
Any ideas?The array of radio buttons:
radGr1_1
radGr1_2
radGr1_3
radGr1_4
radGr1_5
radGr1_6
radGr2_1
radGr2_2
radGr2_3
radGr2_4
radGr2_5
radGr2_6
radGr3_1
radGr3_2
radGr3_3
radGr3_4
radGr3_5
radGr3_6
radGr4_1
radGr4_2
radGr4_3
radGr4_4
radGr4_5
radGr4_6
radGr5_1
radGr5_2
radGr5_3
radGr5_4
radGr5_5
radGr5_6
radGr6_1
radGr6_2
radGr6_3
radGr6_4
radGr6_5
radGr6_6
Those listed with “radGr1” are in the first group box labeled grpST, “radGr2” are in the second group box labeled grpDX, and so on (grpCN, grpIQ, grpWS, grpCH). What I want the code to do is change the labels of the radio buttons so that the text displayed
in everything with a suffix of “_1” is filled with the first number in the selected listbox. For example, if I select the first list box, the other 2 are cleared and only the 6 numbers in the first one are used for the rest of the program. If those numbers
are 12, 13, 14, 15, 17, and 11, then everything with _1 at the end should have “12”, everything with _2 should have “13”, and so on. What I don’t want to have to do is initialize 36 elements, then have 6 different selections for each group box. I tried to
attach an image, but it wouldn’t let me…something about verifying my account or something…
Can I suggest a different layout? It seems like the status selection process is over-complicating the code... please consider this form layout:
Once the user has selected the set of rolls they want you use, you can then just work with that single listbox. The radio buttons let them select a particular stat and the listbox lets them select a value. The "<-" button then assigns
the selected value to the selected stat, and removes it from the listbox. The "->" button clears the selected stat and returns the value to the listbox. The code is something like:
Public Class Form1
Private Sub SetButton_Click(sender As Object, e As EventArgs) Handles SetButton.Click
If ChosenRollsListBox.SelectedIndex > -1 Then
Select Case True
Case StrRadioButton.Checked
If Not StrLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(StrLabel.Text)
End If
StrLabel.Text = ChosenRollsListBox.SelectedItem.ToString
ChosenRollsListBox.Items.RemoveAt(ChosenRollsListBox.SelectedIndex)
Case DexRadioButton.Checked
If Not DexLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(DexLabel.Text)
End If
DexLabel.Text = ChosenRollsListBox.SelectedItem.ToString
ChosenRollsListBox.Items.RemoveAt(ChosenRollsListBox.SelectedIndex)
Case ConRadioButton.Checked
If Not ConLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(ConLabel.Text)
End If
ConLabel.Text = ChosenRollsListBox.SelectedItem.ToString
ChosenRollsListBox.Items.RemoveAt(ChosenRollsListBox.SelectedIndex)
Case IntRadioButton.Checked
If Not IntLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(IntLabel.Text)
End If
IntLabel.Text = ChosenRollsListBox.SelectedItem.ToString
ChosenRollsListBox.Items.RemoveAt(ChosenRollsListBox.SelectedIndex)
Case WisRadioButton.Checked
If Not WisLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(WisLabel.Text)
End If
WisLabel.Text = ChosenRollsListBox.SelectedItem.ToString
ChosenRollsListBox.Items.RemoveAt(ChosenRollsListBox.SelectedIndex)
Case ChaRadioButton.Checked
If Not ChaLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(ChaLabel.Text)
End If
ChaLabel.Text = ChosenRollsListBox.SelectedItem.ToString
ChosenRollsListBox.Items.RemoveAt(ChosenRollsListBox.SelectedIndex)
End Select
End If
End Sub
Private Sub ClearButton_Click(sender As Object, e As EventArgs) Handles ClearButton.Click
Select Case True
Case StrRadioButton.Checked
If Not StrLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(StrLabel.Text)
StrLabel.Text = "_"
End If
Case DexRadioButton.Checked
If Not DexLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(DexLabel.Text)
DexLabel.Text = "_"
End If
Case ConRadioButton.Checked
If Not ConLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(ConLabel.Text)
ConLabel.Text = "_"
End If
Case IntRadioButton.Checked
If Not IntLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(IntLabel.Text)
IntLabel.Text = "_"
End If
Case WisRadioButton.Checked
If Not WisLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(WisLabel.Text)
WisLabel.Text = "_"
End If
Case ChaRadioButton.Checked
If Not ChaLabel.Text = "_" Then
ChosenRollsListBox.Items.Add(ChaLabel.Text)
ChaLabel.Text = "_"
End If
End Select
End Sub
End Class
This may not suit your requirements but I thought it was at least worth considering an alternate design that would be much easier to implement.
Reed Kimble - "When you do things right, people won't be sure you've done anything at all" -
i wan to declare array as a instance variable.
i am below sample prog. , i get incorrect output.
is there any other way;
class a
int m[];
a(int ab[])
m = new int[3];
m = ab;
void print()
System.out.println(m[0]+" "+m[1]+" "+m[2]);
class test1
public static void main(String args[])
int score[] = new int[3];
a group[] = new a[3];
int flag=0;
for (int k=0;k<3;k++)
for(int i=0;i<3;i++)
if(flag==0)
score[i] = i+10;
else
score[i] = i+100;
flag++;
group[k] = new a(score);
group[k].print();
group[0].print(); // incorrect output as it prints last inputted value
}// score[k] = i+10;
// it is not my problem, my problem is that the value of group[0] is not printed out of the loop. inside the for loop , its prints allright but outside the loop its get all wrong. i want to know that anything is wrong with class A structure.
class A
int m[];
A(int ab[])
m = new int[3];
m = ab;
void print()
System.out.println(m[0]+" "+m[1]+" "+m[2]);
class test1
public static void main(String args[])
int score[] = new int[3];
A group[] = new A[3];
int flag=0;
for (int k=0;k<3;k++)
for(int i=0;i<3;i++)
if(flag==0)
score[i] = i+10; else
score[i] = i+100;
flag++;
group[k] = new A(score);
group[k].print();// print correct output
group[0].print(); // prints value of group[2]
} -
How to read contents of an array into a variable?
Gurus,
I'm trying to read contents of a table or array into a varray variable. I want to know the syntax of how to accomplish the same. Please help
Here is what i have,
v_sub_query varray(10) of varchar2;
v_sub_query should read contents of an array and hold values. I'm trying to do this and then use each values of v_sub_query(index) into a dynamic sql statement.
thanks
SSSign is definately not king when it comes to PL/SQL as his advice is flawed. Row-by-row processing simply causes a lot of context switches from the PL/SQL engine to the SQL engine and back. And this results in a significant performance impact. Never mind that this style of 80's COBOL processing it sadly outdated in the 21st century when dealing with a modern RDBMS likle Oracle.
The correct way to populate an array in PL/SQL with SQL data, is to bulk collect it. However, a varray data type is not the best suited data type for this - as they are fixed sized. Dynamic arrays are more flexible.
Simple example:SQL> declare
2 type TStrings is table of varchar2(30);
3 cursor c is select object_name from all_objects order by 1;
4 v_NameTable TStrings;
5 begin
6 open c;
7 loop
8 fetch c bulk collect into v_NameTable limit 100; -- fetch 100 rows at a time
9 -- process the array
10 for i in 1..v_NameTable.Count
11 loop
12 -- process element v_NameTable(i)
13 null;
14 end loop;
15 exit when c%NOTFOUND;
16 end loop;
17 close c;
18* end;
SQL> /Refer to the Chapter 5. Using PL/SQL Collections and Records of the Oracle® Database PL/SQL User's Guide and Reference guide.
As for dynamic SQL - remember to use bind variables. Do not hardcode the array values into the SQL statement as the resulting SQL will not be sharable and will cause performance problems with SQL parsing and shared pool memory fragmentation and malloc errors.
Maybe you are looking for
-
PL/SQL function body returning SQL Query Problem
I have wandered around the forums and found quite a bit of helpful information that has gotten me to the point I am now at. Unfortuntely, PL/SQL is not my strongest point and I am getting an error when I attempt to run my report. This is what I have
-
HELP! HP LaserJet Pro M1217nfw MFP Wireless setup
I cannot set up my HP LaserJet Pro M1217nfw MFP to print wirelessly. I do not have a router and bought this machine because I was told this printer was an easy ad hoc install. I have a MacBook that runs OS X 10.6.8. 4 hours later and I'm dying here!
-
When placing a JPG as a Smart Object (and even multiples) into a layered TIFF file: If I open each layered Smart Object JPG, make changes as a JPG and SAVE the file, I expect the ORIGINAL SOURCE JPG file that was placed to also be saved- I thought t
-
Hi, I am having a problem with group by clause, where I am trying to fetch some records based on bookings made each month and for last one year. I am using Oracle 10g. A short explanation of the scenario is as follows: Table1(Job table) which has Job
-
iPhone 1 IOS 4.2.1 not retaining revised email password on mobileme mail (now iCloud) account. Accepts new code and verifies correct in settings but rejects when attempt to download mail as password incorrect. Reversion to settings shows accepted c