Concatenate variable in an array
Hi,
I would like that array to be 2 dimensionals.
$ArrayFichiers= @(("modules\variables.psm1",$PCompletTrousse+"\variables.psm1"))
At the end, I get actually
000 "modules\variables.psm1" Thats' correct
001 $PCompletTrousse Wrong
002 "\variables.psm1" Wrong
I should get
00 "modules\variables.psm1"
01 "c:\temp\...\variables.psm1"
What is wrong?
Thanks,
François
You don't need the plus, just enclose the whole thing in quotes:
$ArrayFichiers= @(("modules\variables.psm1","$PCompletTrousse\variables.psm1"))
Or you can use brackets:
$ArrayFichiers= @("modules\variables.psm1",($PCompletTrousse+"\variables.psm1"))
Similar Messages
-
Hi All,
Culd you please tell me where I can declare a global variable as an array in PI 7.1.
In PI 7.O we used to store global variables in java sections and it was recognized across mapping in message mapping
In PI 7.1 I have declared a variable in init function in functions tab in message mapping but its not recognized in my mapping.
Could you please help me with this?
Where I have to declare a global variable so that I can use it anywhere in mapping?
Thanks in advance
Best Regards,
Harleen Kaur ChadhaPlease refer to the below link about how to use global variables in PI 7.1.
/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
This link will help you understand how to use graphical valiable as a global variable.
Thanks,
Hetal -
ABAP field symbols and PERL reference variables to unnamed arrays.
Rob -
Please do NOT delete this post even though it contains this link:
ABAP field symbols and PERL reference variables to unnamed arrays.
to a question I posted in the Scripting Languages forum.
It's a question that should be of interest to ABAP programmers, and they may miss if they don't frequent the SL forum ...
Thanks for your forbearance here (in advance, of course) ...
Best
djh
Edited by: Rob Burbank on Jul 11, 2011 1:26 PMIf interested, please reply in the original thread. We don't want multiple conversations at cross purposes do we?
Rob -
CVP Call Studio - concatenate variable data
Hello,
I'm new to Call Studio, do not have my hands on the software yet.
Is it possible to concatenate variable data within a call studio script?
The business wants to capture IVR menu selections for reporting purposes. The IVR is complex and will require a CVP VXML server application. My plan is to utilize a call variable within call studio, update the variable with flags/values for each menu selection, then send this data back to ICM. In ICM, I will analyze this variable and set call types accordingly for reporting.
Thanks in advance,
MikeGot it.
ok, so in call studio i would do it like this.i would define one variable say session data "retVAL" and update its value based on menu selection.
if you closely loom at attached screenshot everything is there. value of all 3 menu options are concatenated and assigned to session data called retVAL using substitution builder.
and the value of same variable is returned to ICM using CVP sub dialog return.
regards
Chintan -
Multiple variable initialization using arrays
Hi,
In my program I want to initialize some 20 odd variables(all of the same type) to the same value having their names as Input1, Input 2 .. Input 20. Want I want to do is to use an array to do this rather than writing the 20 variables one after the other. Is there any way to do so ?
Please help.
Thanx in advance,
GauravHi Again,
I am sorry for framing the question wrongly. What i want exactly is this :
I want to create a variable no. of arrays (the number of arrays will be inputed by the user). I want to initialize them ,something like this
int Input1 [] = new int [400];
int Input2 [] = new int [400];
After this initialization I will then fill these with some info. from a file and then use it in my program.
So I want to use a for loop or some other loop so that I can achieve this.
Please help,
Thanks
Gaurav -
How can I use a variable as an array's name?
Ok I have several arrays in my code (lets call them "array1", "array2" etc) and I want to load them based on the users input. So if the user enters array1, I want the first array to be loaded, and the same with the other arrays.
I tried saving the user's input on a string variable called ARRAY_NAME, so that each time the user enters a different array name, the corresponding array is loaded. Something like this:
ARRAY_NAME[c1][c2]; but I get this error:
array required, but java.lang.String found
ARRAY_NAME[c1][c2];
___________^
Can you please tell me what is the correct way of doing it?
Thanx!The short answer is you can't. An object name can't be
variable and must be known at compile time. But you
could associate the user input name with a particular
array, for example, using a HashMap with the user name
as the key to an array. However, you'd need to use a
container class (Vector, ArrayList, etc.) rather than
a raw array, because containers only take class
instances as elements.Maps can't deal with primitives, that is true. However, arrays are full scale objects, so they can be put into maps.
Also, my code had a bug in it. Try this:
int userIndex = getUserIndex();
String userInput = getUserInput();
Field array = getClass().getDeclaredField(userInput);
Object item = Array.get(array.get(this), userIndex); -
Using a variable to select array value
Hey,
Im fairly new to Java, and im doing a course in it at the moment. I have been set some homework to do, but ive got a little stuck ...what i have to do is create a program that randomly generates numbers between 1 and 10, and then i have made an array which has 10 values, and say number 1 comes up in the random number generation, i want array [1] to have the number of times 1 appears in it. Ive came up with the following, but i keep getting errors ...i think there is a problem with defineing the variable i as a long, then the array as an integer...
int[] ar = {0,0,0,0,0,0,0,0,0,0};
int a = 0;
while (a<10)
a++;
long i = Math.round(Math.random()*10);
ar[i] = i;
System.out.println(ar);
with that code i get these errors:
found : long
required: int
ar[i] = i;
^
C:\Website Projects\Java Work\test 1\Document.java:14: possible loss of precision
found : long
required: int
ar[i] = i;
if anyone could help me get this working i would be most greatful
Thanks for your time,
-Rossah k thanks for the response :) ...ive managed to narrow it down to one error:
public class random {
public static void main(String[] args){
int[] ar = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int i = 0;
while (i < 10){
int t = Math.round(Math.random()*10);
int ar[t]++;}
i++;
System.out.println(ar);
gives the error:
C:\Website Projects\Java Work\test 1\random.java:8: ']' expected
int ar[t]++;}
^
1 error
Tool completed with exit code 1
Im pretty sure it just doesnt like the value of the Math.xxxx being int, i was told it requires long/double...i need to convert it somehow after its done the calculation, i think :-S
Thanks,
Ross -
Passing variables in an array to jtextarea?
What method could I use to pass different Strings in an array to a jtextarea each time the "Next" button (a JButton) in my JFrame is pressed? So, for example, if i hit next, i might want the word "frank" to print in the jtextarea, but the next time i hit it, i might want it to print "joe" Thank you!!
This is my code:
public class discardedSaluteMyShorts extends JPanel implements ActionListener
JTextArea textArea;
String newline = "\n";
static final public String NEXT = "next";
public discardedSaluteMyShorts()
super(new BorderLayout());
//Create the toolbar.
JToolBar toolBar = new JToolBar("Still draggable");
addButtons(toolBar);
//Create the text area used for output. Request
//enough space for 5 rows and 30 columns.
textArea = new JTextArea(5, 30);
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
//Lay out the main panel.
setPreferredSize(new Dimension(450, 130));
add(toolBar, BorderLayout.PAGE_START);
add(scrollPane, BorderLayout.CENTER);
public void addButtons(JToolBar toolBar)
JButton button = null;
//third button
button = makeNavigationButton("Forward24", NEXT,
"Next light or sound cue",
"Next");
toolBar.add(button);
public JButton makeNavigationButton(String imageName,
String actionCommand,
String toolTipText,
String altText)
//Look for the image.
String imgLocation = "images/"
+ imageName
+ ".gif";
URL imageURL = discardedSaluteMyShorts.class.getResource(imgLocation);
//Create and initialize the button.
JButton button = new JButton();
button.setActionCommand(actionCommand);
button.setToolTipText(toolTipText);
button.addActionListener(this);
if (imageURL != null)
{ //image found
button.setIcon(new ImageIcon(imageURL, altText));
else
{ //no image found
button.setText(altText);
System.err.println("Resource not found: "
+ imgLocation);
return button;
public void actionPerformed(ActionEvent e)
String cmd = e.getActionCommand();
String cmd1 = e.getActionCommand();
String description="";
String description1 = "";
String description2 = "";
// Handle each button.
if (NEXT.equals(cmd))
{ // third button clicked
description="23 up";
description1 ="23 down";
description2="adsfsd";
displayResult(description, description1, description2);
public void displayResult(String description, String description1, String description2)
JButton button = new JButton();
button.getActionCommand();
textArea.append(description + newline);//adds description to document
if(button.getActionCommand()!=null)
textArea.append(description1 + newline);
textArea.append(description2 + newline);
textArea.setCaretPosition(textArea.getDocument().getLength());//scrolls down
public void nextCue1()
String description2 = "asdfasasdf";
displayResult2(""+description2);
public void displayResult2(String description2)
String description3 = ".";
textArea.append(description2 + newline);//adds description to document
textArea.setCaretPosition(textArea.getDocument().getLength());//scrolls down
public void displayResult3(String description3)
textArea.append(description3 + newline);//adds description to document
textArea.setCaretPosition(textArea.getDocument().getLength());//scrolls down
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event dispatch thread.
public static void createAndShowGUI()
//Create and set up the window.
JFrame frame = new JFrame("ToolBarDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Add content to the window.
frame.add(new discardedSaluteMyShorts());
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args)
//Schedule a job for the event dispatch thread:
//creating and showing this application's GUI.
SwingUtilities.invokeLater(new Runnable()
public void run()
//Turn off metal's use of bold fonts
createAndShowGUI();
}Edited by: cubswar on Apr 1, 2008 8:47 PMFirst you declare the array and the index you currently are on in your class on the global variables section so for example:
public class discardedSaluteMyShorts extends JPanel implements ActionListener {
private int index = 0;
private String arr[] = new String[] { "frank", "joe" };
// The code would be here
}Then in the method which displays the next value:
public void showNextValue() {
textArea.setText(arr[index]);
index = (index + 1) % arr.length;
}You probably want to call the method from the action performed of the button. -
Concatenate variable to filename to generate ERROR_LOG_FILENAME
Hi
I'm working with IKM SQL to Hyperion Planning/Essbase
I'm trying to concatenate a file path variable to a filename in order to generate an ERROR_LOG_FILENAME value.
I've tried a few permutations such as below, but can't get it working.
#FilePathVariable<%=odiRef.getPop("POP_NAME")%>.csv
Can somebody suggest how this can be achieved?
CheersI think it doesn't like the concatenation. It works if I put the entire filepath, including the filename, into the variable.
But I would like the file directory path to come from the variable (for portability to other environments) and the filename to correspond to the interface. I don't want to have to create one variable for every interface.
Cheers -
Check variable against an array of words
Hi,
I wish to check a variable for a number of words that are in
a array.
Not sure if this is the best way to do it, but this is what i
have.
I have my own counter system that counts every visitor, but
some of these visits are from BOTS, spiders..
So i wish to have a method of searching the HTTP_USER_AGENT
for certain words i put in a array.
What i am after is how i get the words in an array and how i
then get the script to check the HTTP_USER_AGENT for a word in the
array and if so it will not complete the script. (not add to the
counter)
if none of the words are in the HTTP_USER_AGENT then it will
add to the counter.
so something like?
<?
// do array
// check if HTTP_USER_AGENT contains a word from array
if () {
// increase counter if none of the words are in
HTTP_USER_AGENT
include(increase.php);
?>
its the bit between the if () that i have no idea about, any
help would be great.
cheers in advance for your help.
Jasonnot very clever wrote:
> this is a bit more about what i am trying to do.
>
> <?
> // do array
> array(1)="something";
> array(2)="something else";
> array(3)=..
> ..
> ..
>
>
> $HTTP_USER_AGENT = contants of the HTTP_USER_AGENT
> // check if HTTP_USER_AGENT contains a word from array
> if (array(x) is in the string $HTTP_USER_AGENT) {
> // increase counter if none of the words are in
HTTP_USER_AGENT
> include(increase.php);
> }
>
> ?>
>
>
$myArray = array('blip','blop','glup',...);
$counter = 0;
foreach($myArray as $mA){
if(preg_match('/'.$mA.'/',$HTTP_USER_AGENT)){
$counter++;
seb ( [email protected])
http://webtrans1.com | high-end web
design
Downloads: Slide Show, Directory Browser, Mailing List -
Convert variable into an array
I have variable, abc; whose value is in the format val1,val2,val3,..
I want to convert it into an array, like that arr[0]=val1; arr[1]=val2; so on. How can I do this?
Usmanexamine this class that I did
import java.lang.*;
public class ReadString {
public static void main(String[] args){
String abc = "1,2,3,4,5,6";
StringBuffer abc2 = new StringBuffer(abc);
int arrayLength = abc2.length(); //get length
int[] abcFinal = new int[6];
for (int i=0; i<arrayLength; i++) { //test characters
int anIndex;
if (!(abc2.substring(i,i+1)).equals(",")) { //if it is a number
//(i/2) is ta little formula to be able to assign the
//right index in the intArray to the number
anIndex = (i/2);
//set value to array
abcFinal[anIndex] = Integer.parseInt(abc2.substring(i,i+1));
for (int j=0;j<abcFinal.length;j++ ) {
System.out.println("i = " + j + " value = " + abcFinal[j]);
}//end main
}//end class -
Can a session variable be an array?
I have a dynamic list which may have multiple values
selected. I can capture the resulting array in a $_POST variable.
Using the Insert Record behavior, I cannot cause the $_POST
variables to be sent to the redirect page unless I use session
variables. Can a session variable be defined as an array? If so,
how do I declare it as an array and how do I move the form variable
array to a session variable array? If it can't be an array, how do
I define the target variables for 0 to x items from a form variable
array?I can't answer specifically for PHP but in the other
languages as session
variable is basically a holding place for a value. As a comma
is a valid
character then if you have a comma delimited list (which is
what a form give
you if multiple items are selected) then you simple assign it
to the session
variable and it will be stored as such.
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"Rankin" <[email protected]> wrote in
message
news:ef9suk$iqe$[email protected]..
>I have a dynamic list which may have multiple values
selected. I can
>capture
> the resulting array in a $_POST variable. Using the
Insert Record
> behavior, I
> cannot cause the $_POST variables to be sent to the
redirect page unless I
> use
> session variables. Can a session variable be defined as
an array? If so,
> how
> do I declare it as an array and how do I move the form
variable array to a
> session variable array? If it can't be an array, how do
I define the
> target
> variables for 0 to x items from a form variable array?
> -
Local variable for an Array of fixed size
Hello,
I have a two multirate loops in a VI.
In one loop, I want to refer an fixed sized array initialized in the other loop.
But I coudn't name the array, so I can't refer it.
Is there any way to refer it?
Thanks,
Young.If you need a local variable, there is no other way than to create an indicator for it.
In LabVIEW there is no "fixed length" array : you can always add or remove an array element, and you don't need to declare it as in other languages. They are intrinsic dynamic objcets. Of course, the memory manager has to cope with this, that's why it's often better to initialize an array, to give it its final size immediately, resulting in faster running programs. However, this is only noticeable with relatively large arrays (> 10000-100000 elements).
May be you should explain in more details what you intend to do, because trying to reproduce a C approach in LV is probably not the best thing to do. For instance, you said that you are initializing your array in a first loop. You mean that you re-initialize the array at each iteration ? I suppose no, so may be you could put the initialize step out of the loop, and wire the array to your two parallel loops.
Remember also that local variables are not always good programming solutions, since using them will generate copies of their content each time they are refered to. And that can low down your program very significantly...
Message Edité par chilly charly le 11-05-2005 05:05 PM
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
Jsp variables to javascript array, for loop dont work.
This works fine. con.getmake passes a different variable each time to the javascript array using a manual index.
<script>
make[0] = "<%= con.getmake() %>" ;
document.write(make[0]);
make[1] = "<%= con.getmake() %>" ;
document.write(make[1]);
make[2] = "<%= con.getmake() %>" ;
document.write(make[2]);
make[3] = "<%= con.getmake() %>" ;
document.write(make[3]);
</script>
If I try and do the same with a for loop, It seems as though all the elements hold the same first variable retrieved from con.getmake, I am not getting the next variable from my java class.
<script>
for (var i= 0; i <= 2; i++)
make[i] = "<%= con.getmake() %>" ;
document.write(make);
</script>Hi,
Java is parsed once on the server which creates a HTML page, then it is passed to the client's browser where the javascript is executed. So con.getmake() is only executed once in java. You've got to execute your loop in java not javascript :
<script>
<%
for (int i= 0; i <= 2; i++)
%>
document.write("<%= con.getmake() %>");
<%
%>
</script> -
Strange behaviour with Vision 8.2 and Shared Variable 1D Image Array
I've just upgraded to LabVIEW 8.2 and Vision 8.2. When loading a particular VI, it is searching numerous times for ...\LabVIEW 8.2\resource\objmgr\IMAQ Image.ctl - which of course doesn't exist. As best as I can track it down, this seems to be cause by a Shared Variable I have in the project which is a custom control of a 1D array of Image.
So I've created a new project from scratch to illustrate (attached). The VI runs OK, but any editing means that this non-existant control is searched for again. Of interest is also that there is a coercion dot where the Image is used, but the data type on the wire seems OK. Creating a control (rather than a Shared Variable) works fine.
Anyone know what's going on here?
Message Edited by GregS on 02-26-2007 03:43 PM
Attachments:
1DImage.png 4 KB
1DImageShared.zip 15 KBHello Greg,
I downloaded your project and opened it up on my
system. I received the same results as you
did – I tried to open the project it searched for \LabVIEW 8.2\resource\objmgr\IMAQ Image.ctl. I also used the 1d Image.ctl file as a constant on my block diagram and it did not
show the coercion dot as you mentioned.
There does seem to be some strange behavior going on here
with the coercion dot and the shared variable.
I will have to look further into it and report this to R&D.
But for now, we need to address your application. What is the goal of your application? How does using a shared variable with IMAQ
Images help you get there? You may be
aware of this already, but when an Image wire is passed around LabVIEW, it is
not actually passing a copy of the data in a dataflow manner. The large size of IMAQ Images necessitates
that LabVIEW pass around a pointer to the IMAQ Image. Therefore, when an array of Image controls is
made and used as a shared variable, the controls do not contain the actual
image data. Instead, they contain
pointers to the IMAQ Images. When they
are passed into a shared variable, unexpected results may occur. If the shared variable is network published,
for example, another computer on the network would receive a pointer to an
image that it would not be able to find or access.
There may be a much better way than shared variables to
achieve the same functionality you are currently looking for. If you do in fact require shared variables,
you could use IMAQ ImageToArray.vi
to create an array that can be used in the shared variable like any other data
type, and then use IMAQ ArrayToImage.vi
on the other end to be able to view the array as an image.
Please post back with more information about your
application and we should be able to find the best solution for you.
Regards,
Luke H
Maybe you are looking for
-
After I did the new update to my phone, all of my "smart playlists" no longer sync.
It's so annoying because now I can't listen to my recently added. Any way to get it back? The playlists such as "Recently Added" "Top 25 Played" "Recently Played" and "My Top Rated" Anyone know what to do, please?
-
Unable to install windows 8.1 on inspiron 15
when I try to download windows 8.1 it denies my request because im not an administrating account yet my account is the only one on my computer and I don't know how set it up as an administrator
-
Can anyone tell me what the actual screen dimensions (height and width) of a 17" iMac? Thanks. I use Sibelius and Logic Express and would like something that has enough height and am deciding between a Mini with a big monitor or a 17" iMac. I find th
-
How to fetch screen field in HR abap
hi friend, I need to fetch a screen field q0128-tdline. And the field should be included in payslip. Is there any user exit to proceed with this.Please reply ASAP. Thanks and Regards K.karthikeyan.
-
Hi InDesign CC 32bit / 64 bit in one Package?
Hi everybody, I am using the manual bundling tool which includes the manifest file. I have windows builds for 32 and 64 bit, but I do not understand how to create a bundle that contains both and that only copies the files that are labelled with the p