Variable vector names???
hi,
i'm new to this java action, so sorry if this is really obvious, but i can't get this to work.
i need to assign information to a different vector within a loop so for example>>>>>>
String[] nameofvector = { "nameVector", "productVector", "typeVector" };
for (int i=1; i<= 3;i++) {
Vector eval(nameofvector) = new Vector(); //i know eval doesn't work but it's
eval(nameofvector).elementAt(i) = nameofvector[i] // there so you can see what i'm trying to do
any ideas?
thanks,
ben
btw: this is my 1st post ;)
You can use Hashtable (or one of the other Map classes). It takes a key-value pair, where the key could be the name of your vector, and the value is the vector:
Hashtable vectors = new Hashtable();
vectors.put("nameVector", new Vector());
vectors.put("productVector", new Vector());
vectors.put("typeVector", new Vector());
// to get a named vector:
Vector vector = (Vector)vectors.get("productVector");You could also have an array of vectors, and make constants for the 3 vectors.
public static final NAME_VECTOR = 0;
public static final PRODUCT_VECTOR = 0;
public static final TYPE_VECTOR = 0;
private Vector[] vectors = new Vector[3];
// ... inside the construtor:
for (int x = 0; x < vectors.length; x++) {
vectors[x] = new Vector();
// to get a vector:
Vector vector = vectors[PRODUCT_VECTOR];
Similar Messages
-
Using a variable to name a window?
Is it possible to use a user-defined variable to name a
window? I'm hoping to set up a "template" system of sorts for a
family of products, all of which are very similar. I'd just like to
name the window accordingly to the product name via a variable if
possible.Hi there
If this is a feature you feel would be a valuable addition to
those offered by RoboHelp, consider telling the Adobe RoboHelp
Development team about it. You may do that by
clicking
here and completing the form.
Cheers... Rick -
Variable file name through Receiver mail Communication channel
I need to send a file through receiver communication channel with the following name ( YYMMDD schema) . The YYMMDD is current date . I know how to create these file names throug FCC ( file communication channel) , I tried in the same manner to create this file through Receiver Mail CC , but it did not work . If you have any ideas , can you please share with me ?
ABC_MMYYDD.TXT
Thanks.
RitvikHi Ritvik,
Also, Please look at this link and see if it helps you. It is generating variable file name through a UDF
Re: Problem in dynamically file name generation procedure
Best Regards -
Using variable coulmn name in sql function
Hi there,
I am not an expert with PL/SQL and I can not figure out how to use variable column names in my function.
My function is:
CREATE OR REPLACE FUNCTION RESET_TRIGGERS(aTrigger VARCHAR2) RETURN NUMBER IS
TEMP_ID NUMBER;
TEMP_USER_ID NUMBER;
BEGIN
SELECT 'LIMS.'||'$aTrigger'||'.NEXTVAL' INTO TEMP_ID FROM DUAL;
SELECT 'LIMS.'||'$aTrigger'||'_USER.NEXTVAL' INTO TEMP_USER_ID FROM DUAL;
IF TEMP_ID > TEMP_USER_ID THEN
LOOP
SELECT LIMS.SQ_U_FINALRESULT_USER.NEXTVAL INTO TEMP_USER_ID FROM DUAL;
EXIT WHEN TEMP_USER_ID = TEMP_ID;
END LOOP;
ELSE
WHILE TEMP_ID < TEMP_USER_ID LOOP
SELECT LIMS.SQ_U_FINALRESULT.NEXTVAL INTO TEMP_ID FROM DUAL;
END LOOP;
END IF;
COMMIT;
RETURN (TEMP_ID);
END;
What I want is that I pass a seqencename with aTrigger and that two triggers will be equal if not.
eg ifaTrigger = 'SQ_U_FINALRESULT'
than I want the triggers LIMS.SQ_U_FINALRESULT and LIMS.SQ_U_FINALRESULT_USER to be set equal.
The above function will not work, but what will?????
I hope you can help me out!
CheersA very strange function indeed.
But here is what I think he meant to do:
SQL> create procedure reset_sequences
2 ( p_sequence_name in varchar2
3 , p_nextval out number
4 )
5 is
6 l_nextval1 number;
7 l_nextval2 number
8 ;
9 procedure reset_sequence_value
10 ( p_sequence_name in varchar2
11 , p_current_value in number
12 , p_new_value in number
13 )
14 is
15 l_dummy number;
16 begin
17 execute immediate 'alter sequence ' || p_sequence_name || ' increment by ' || to_char(p_new_value-p_current_value);
18 execute immediate 'select ' || p_sequence_name || '.nextval from dual' into l_dummy;
19 execute immediate 'alter sequence ' || p_sequence_name || ' increment by 1';
20 end reset_sequence_value
21 ;
22 begin
23 execute immediate
24 'select ' || p_sequence_name || '.nextval,' || p_sequence_name || '_user.nextval from dual'
25 into l_nextval1, l_nextval2
26 ;
27 if l_nextval1 < l_nextval2
28 then
29 reset_sequence_value(p_sequence_name,l_nextval1,l_nextval2);
30 end if
31 ;
32 if l_nextval1 > l_nextval2
33 then
34 reset_sequence_value(p_sequence_name || '_user',l_nextval2,l_nextval1);
35 end if
36 ;
37 p_nextval := greatest(l_nextval1,l_nextval2)
38 ;
39 end reset_sequences;
40 /
Procedure is aangemaakt.
SQL> show err
Er zijn geen fouten.
SQL> create sequence testseq start with 5 increment by 1
2 /
Reeks is aangemaakt.
SQL> create sequence testseq_user start with 2 increment by 1
2 /
Reeks is aangemaakt.
SQL> declare
2 l_new_value number;
3 begin
4 reset_sequences('testseq',l_new_value);
5 dbms_output.put_line(l_new_value);
6 end;
7 /
5
PL/SQL-procedure is geslaagd.
SQL> select testseq.currval from dual
2 /
CURRVAL
5
1 rij is geselecteerd.
SQL> select testseq_user.currval from dual
2 /
CURRVAL
5
1 rij is geselecteerd.Regards,
Rob. -
Variable in ''Name of Variable(Input Only Using F4).' for variant attribute
Hi All,
I Have a small problem with saving variant.
I am trying to save the Variant.In the varaint Attributes we have a field 'Name of Variable(Input Only Using F4).
I have created the PID 'XUS' in SU3.But i am not able to to view the variable in ''Name of Variable(Input Only Using F4).'.
Anybody please let me know how to make it.
Thanks,Please follow the below steps to restrict the user to access 2 company codes,
1)Mark the IO(Company code) Authorization relavent and activate it.In the IO Business Explorer tab check the Authorization relavent check box.
2)Go to T-code RSECADMIN -Under Maintainance -Enter the name of Authorization Object an click on create Authorization.Insert the IO and also SAP recomended Objects 1.0TCAACTVT, 2.0TCAIPROV and 3.0TCAVALID.
Maintain the values for these objects.Select the company code and click on details.
3)T-code RSU01-Enter the name of the user to be assigned with the authorization object and click the change button.The select the relevant authorization object and save.
4)Create Authorisation Variable in Query Designer Create an Authorization Variable - Variable with Processing by Authorisation in Query Designer as Below for Sales Organisation
Note : Also include all Authorisation Relevant Objects which are used in that infoprovider in addition to the above additional 3 objects otherwise you may get "No Authorisation" error when you execute the query.
Note : 0BI_ALL is the authorization object to access all the info objects which are authorization relevant.
Reagrds,
Ramitha -
Hi Friends,
I have a question related to SAP Variable usage in MDX statement.
I have a hierarchy node variable, which is mandatory and has a default value..
When technical name of this variable is something like ZXYZ_SM, it appears differently in MDX, as !V0000017..
Problem is, i have to use this variable in two seperate queries and this MDX technical name changes query to query..
Eg.: when it is !V0000017 in Query A, it is !V0000015 in Query B.. I need them to be identical across queries, because this is a global filter of a huge dashboard..
Can you please help me how to proceed? I need solution on Bex side..
Thanks in advance,
Sunil
====================================================
SAP Variable tech name needs to be shorter than 10 chars in order to be supported by MDX. So, changing variable name fixed the issue...
====================================
Edited by: SunilKmr on Nov 29, 2010 1:27 PMWhat Rohit is trying to say is that the technical name of the BEX variables is not shown to an end user,
and also not used to combine user input, only the prompt text is.
(BTW, the technical name is determined by the position of the variable prompt in the BEX query,
so the first variable shown will be !V000001, the second !V000002, etc.
So in your case the order in the two BEX queries is different)
So if you have two BEX queries, this means two universes.
Now when you want to report data out of these two universes you will build a query in the WebI report on each universe.
Both queries will ask you for input for their respective BEX variables,
but to do that they using the prompt text, not the tech name.
By default this prompt text will be the name of the BEX variable,
but you can change the text in the universe without implications.
As long as the two prompt texts are the same for these two different tech name variables,
BO will give just one prompt and feed it to !V0000017 in the query on the universe for BEX query A
and !V0000015 in the query on the universe for BEX query B.
Hope this is clear enough,
Marianne -
Variable array names...i think
I have a list of arrays which need filling and i have created a for lop that will run the necessary commands to fill the arrays...
how do i put an array name into the 'for' loop that will change each time...
ie.
for(int x = 0; x < 3; x++)
array ?x? [index] = tempVariable;
}Message was edited by: Reashlin
reashlinYou don't.
An array's index can be variable, but a variable's name cannot. If you really need "named" arrays, put the arrays into a map.
Map<String, int[]> arrayMap = new HashMap<String, int[]>();
int[] array1 = new int[10];
arrayMap.put("array1", array1);
array1[0] = 123;http://java.sun.com/docs/books/tutorial/collections/
Or, if accessing the array by an index is enough, then just use an array of arrays.
int [][] arrays = new int[5][10];
array[0][0] = 1;
... etc. .. -
Variable/method names standardizing
Hi All,
The problem we've got here is that same things are named in slightly different way by different developers or development groups.
Typical example:
'id' property. accessors could be named like: 'getID' or 'getId'.
Or even better example: term 'Work List' implementation of which has nothing to do with Java List. So, property could be named as 'worklist' or 'workList' with similar names for accessors.
I think, this problem is slightly outside of coding standards scope. And as project is very massive ~300000 lines of code, there are a lot of different terms named like in example above.
Has anyone come across such problem before?
I suspect, solution would be to keep a kind of variable/method names library.
Are there any better solutions?
Thanks in advance
AndreiI think, this problem is slightly outside of coding
standards scope. It is, and I'm glad it is because the "people" who make the standards that we do have end up creating dumb, inconsistent stuff as it is. Better they don't get too granular.
Has anyone come across such problem before?Every day
I suspect, solution would be to keep a kind of
variable/method names library.
Are there any better solutions?How you name stuff is a matter of opinion. I personally don't care if you do someID or someId or even someid, what kills me is stuff like someid and someid. But again, it's all what you're used to. -
Declare a variable typed "name of a class"-Need help
I have "segment" class in package named Ex13
import Exercise12.Point123;
public class segment {
private Point123 start;
private Point123 end;
public segment(Point123 start, Point123 end) {
this.start = start;
this.end = end;
public double length() {
return start.distance(end.getX(), end.getY());
public String midlePoint() {
return (end.getX() + start.getX()) / 2 + " "
+ (end.getY() + start.getY()) / 2;
// return insidePoint(1,1);
public Point123 insidePoint(double m, double n) {
double ratio = m / (m + n);
return new Point123(start.getX()+(end.getX() - start.getX()) * ratio,
start.getY()+(end.getY() - start.getY()) * ratio);
//return (start.getX()+(end.getX() - start.getX())*ratio);
}And class "Point123" in package Ex12:
public class Point123 {
private double x;
private double y;
public Point123(double xAsis, double yAsis) {
x = xAsis;
y = yAsis;
public double getX() {
return x;
public double getY() {
return y;
// public String toString() {
// return String.format("%.1f,%.1f", x, y);
public boolean isOrigin() {
return x == 0 && y == 0;
public boolean isOnX_Axis() {
return y == 0;
public boolean isOnY_Axis() {
return x == 0;
public double distance(double xAsis, double yAsis) {
return Math.sqrt(Math.pow(xAsis - x, 2) + Math.pow(yAsis - y, 2));
}I remove toString method in Point123 class, but whenever I call insidePoint method in segment class it print out "Exercise12.Point123@addbf1". In other hand, I don't remove toString method, I call insidePoint method,then it prints out the correct result which I want.
I think the reason why this thing happened is that I am using Point123 return type in insidePoint method. To midlePoint method in segment class, it does not affect whether I remove toString or not. That is because I use its own String return type.
Can someone tells me whether my thought is correct or not? And explain more about variable typed "name of a class"Oh! My header's segment class does not have extend...., therefore it inherit from the Object. But what is Object in my class?
is it "*s*" in my code?
public class DisplayResult {
public static void main(String[] args) {
segment s = new segment(new Point123(3,4), new Point123(6,7));
System.out.println(s.length());
System.out.println(s.midlePoint());
System.out.println(s.insidePoint(1.5,4));
} -
Variable(?) name in NQSConfig.INI [ REPOSITORY ] section
Originally I had this entry in my environment
BIEE = BIC2G_EE.rpd, DEFAULT;
in Classroom for BI EE course
Star = appdev.rpd, DEFAULT;
Where was declared this (variable?) name (eg. BIEE or Star) ?
Is it arbitrary name ?.RPD is a repository file which reads the Metadata from the data source , so when you set the Star variable make sure you have the DSN set up and you have stopped BI server and BI presentation services.
-
Creating a form with variable table name(s)
Hi,
I am building a form that will allow user(s) switch to other user
(s) dynamically. I have been able able to do this by creating a
non-database table and use record group to read from the base
table of each user.(All the tables in question have the same
structure).
Record group is a read only, and I want to be able to do data
maninpulation with this form.
The questions are
(1) It possible to do data manipulation with record group and if
it is, how?
(2) Is it possible to build a form with a variable table name?
if possible, how?
Somebody pls help.
Thanks,
Olutunde.
nullOlutunde Babarinsa (guest) wrote:
: Hi,
: I am building a form that will allow user(s) switch to other
user
: (s) dynamically. I have been able able to do this by creating a
: non-database table and use record group to read from the base
: table of each user.(All the tables in question have the same
: structure).
: Record group is a read only, and I want to be able to do data
: maninpulation with this form.
: The questions are
: (1) It possible to do data manipulation with record group and
if
: it is, how?
: (2) Is it possible to build a form with a variable table name?
: if possible, how?
: Somebody pls help.
: Thanks,
: Olutunde.
Hi,
you can create and manipulate record groups at runtime(see Forms
Reference 'Create_Group' and 'Add_Group_Row') don't use
Create_Group_from_Query. For your purpose it's better to build a
cursor loop on your Query and add your datas after
manipulating with 'Add_Group_Row' to your Record Group.
It's possible to SET_BLOCK_PROPERTY(QUERY_DATA_SOURCE_NAME) but
it's not possible to change the item property 'Column Name'.
Therefor I would suggest to build a non database block and
populate these block by a programm unit, which works with a
pl/sql cursor loop and the 'create record' to populate these
block.
null -
Dynamically create variables and names
Hi,
I am dealing with some software that will send
me string variables and their values. I have
to process each variable it sends me to get
its value. The problem is I dont know how many
its going to send me in advance, so I cant
hard code the varible names into my class.
At run time I will get a int. value as to the
number of variables. An array won't work and
a vector wont work cause I need to process
each variable by its name. I also know that
each variable name will be some alpha characters
followed by a number. For example:
int 6
test1
test2
test3
test4
test5
test6
The next time it could be 50 ...or 1 or any number....
Is there anyway I can get my class to dynamically
delcare String variables and their names?.......Just use some kind of collection. If you know the alpha characters at compiletime you can use an array - instead of test1 to test6 as in you example, you'd get test[0] to test[5]. (or test[1] to test[6] if you want the numbers to match - just create the array one bigger than needed and leave the [0] unused.) If you don''t know the alpha characters you can use a HashMap or some similar collection, and use the strings "test1", "test2" etc. as keys.
You can also make your own class to handle this, for example by wrapping some code around an array to simplify access to your Strings. -
PHP Code: Using a variable to name the file in an Include
I have a series of case statements assigning a value to the
variable $theme
based on the current month. Then I have a set of files
(january.txt,
february.txt, etc.). The variable values are those file
names:
// get current month as a number
$month = date('n');
// select theme for the month
switch($month) {
case 3:
$theme = 'march.txt';
break;
case 4:
$theme = 'april.txt';
break;
[etc.]
What is the correct syntax for a PHP Include that will use
the current value
of $themes for the filename?
Thanks
Walt<?php include('_inc/'.$theme); ?>
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Walt F. Schaefer" <[email protected]> wrote in
message
news:gqutqv$qbf$[email protected]..
>I have a series of case statements assigning a value to
the variable $theme
>based on the current month. Then I have a set of files
(january.txt,
>february.txt, etc.). The variable values are those file
names:
> // get current month as a number
> $month = date('n');
> // select theme for the month
> switch($month) {
> case 3:
> $theme = 'march.txt';
> break;
> case 4:
> $theme = 'april.txt';
> break;
> [etc.]
> What is the correct syntax for a PHP Include that will
use the current
> value of $themes for the filename?
>
> Thanks
>
> --
>
> Walt
>
>
> -
[JS CS3] Variable Function Name
Hello everyone,
Does anyone know if you can put a variable into a function name?
Bellow is a function that I am working on to avoid using an if statement with 33 possiblilites. It does work but I get a "undefined is not an object error".
function myFunction(){
var myDoc = app.activeDocument;
var myRootXMLElement = myDoc.xmlElements.item(0);
var myData = myRootXMLElement.xmlElements.item("xyzTag");
for (b = 2; b <= 34; b++){
if(b = myData.contents){
myNewFunction = "my"+b+"VariableFunction()";
try{
eval(myNewFunction);
}catch(e){
alert(e);
Because this physically does what I intend it to do I believe this should work but I can't get past this error. Could someone please let me know if there is a way to make this error free?
Regards,
BrettChange this line:
>if (b = myData.contents)
to this:
>if (b == myData.contents)
and it probably works. It is possible to use variables and eval() to call functions. This script works ok:
for (i = 0; i < 3; i++)
f = 'my' + i + 'Func()'
eval (f)
function my0Func ()
$.writeln ('this')
function my1Func ()
$.writeln ('that')
function my2Func ()
$.writeln ('and the other')
Peter -
What I'm trying to do is add event listeners for each position up to the total of compPositions. This way, each one will have a dymanic function name. Right now, they all launch function "clicked1" but I can't figure out how to make it add numbers to the function name dynamically. Is there a different method I should be using to accomplish this goal?
Right now, compPosition = 5 so it should create 5 event listners, but I want them each to have their own function they exucute.
var i;
for (i = 1; i < compPositions +1; i++)
currentPos = "pos" + i;
this["pos" + i].addEventListener(MouseEvent.CLICK, clicked1)
Edit:
Actually, after thinking about it, I think this is a better approach, but I'm not sure how to pass over a variable using a click event.
var i;
for (i = 1; i < compPositions +1; i++)
var currentPos; //now it's private to this for loop
currentPos = "pos" + i;
this["pos" + i].addEventListener(MouseEvent.CLICK, posClicked)
In this version, I just need to pass over the currentPos variable to the function, but I'm not sure if that's possible.
Thanks,
CoreyBefore solving, I would caution why you need them to have a unique function/unique function name. You should be able to have them all hit the same function and do different logic within depending on the target.
That aside, you could do something like this:
for (i = 1; i < compPositions +1; i++)
currentPos = "pos" + i;
this["pos" + i].addEventListener(MouseEvent.CLICK, this["clicked" + i])
However, you would have to manually define each function. Alternatively, you can use closures:
for (i = 1; i < compPositions +1; i++)
currentPos = "pos" + i;
this["pos" + i].addEventListener(MouseEvent.CLICK, getFunction(i))
function getFunction(i:int):Function
return function(e:MouseEvent):void { trace("Clicked " + i); };
EDIT:
Using the closure method you could also pass the current pos if you needed to:
for (i = 1; i < compPositions +1; i++)
currentPos = "pos" + i;
this["pos" + i].addEventListener(MouseEvent.CLICK, getFunction(i, currentPos))
function getFunction(i:int, currentPos:String):Function
return function(e:MouseEvent):void { trace("Clicked " + i + " currentPos = " + currentPos); };
Maybe you are looking for
-
Palm desktop for Zire 72 with Windows Vista, 32 bit
I've tried the version 4.1.4e offered on the website, it is not working, though one page on the site seemed to omit that it would work for Vista. What is strange is that it was working on my system just fine until a month ago. I've uninstalled what
-
I want to purchase a ring back tone but....
When I go to purchase a ring back tone only, it is bundling it with a ring tone for a price of 4.98. How do I just get a ring back tone???
-
Please help - about to throw heavy 8 core out window
I had been using FCP 5 on my iMac for nearly 2 years. I have exported via Quicktime conversion, and straight to Compressor with no real problems with speed. I have a large encoding job to get done, so i upgraded and got Dual Quad 2.8 with 4 gb of RAM
-
Looking for picture editing software for my macbook pro. any suggestions??
I am needing suggestions on a good picture editing software program for my macbook pro. i wanting to starting doing a little photography on the side. i looked up photoshop and there were so many choices i didn't know what would be best for my comput
-
TS3297 My ipad could not be restored. An unknown error occurred 3194
My ipad could not be restored. An unknown error occurred 3194. How can I do now?