Calling variables with dynamic names
so lets say theres 5 variables,
name1 = "james";
name2 = "billy";
name3 = "nilly";
name4 = "dilly";
name5 = "alfred";
is there any way to enumerate through those names by doing something like this...
for(i=1;i<6;i++){
System.out.println(["name"+i]) // where ["name"+i] uses variable name1, name2, name3 etc...
ending up with something like
james
billy
nilly
dilly
alfred
i know its possible to do it in some other programming languages, and if java can do it too, it'd be very useful to me.
woops - noticed I was in New To Java...
You can search for this, the question came up quite a bit some time back.
Use an implementation of Map (like HashMap) and call the put method with the name you want as a key and the value as a value. You can then call get with the name to get the value, or you can iterate over the key set to do what you're after.
Or, you could create a "Name" array (or List) and the you get "name0", let's say, by saying "name[0]" or nameList.get(0).
Make sense?
Good Luck
Lee
Similar Messages
-
FTP Activity - mget multiple files with dynamic names
Hello All
Hope all is well.
I was wondering if there was a way to configure FTP activity to transfer multiple files with dynamic names from source location at daily intervals.
For example, my source files are affixed with date values (source_filename_<mmddyyyy>_<hh>.txt):
source_filename_12252009_00.txt
source_filename_12252009_06.txt
source_filename_12252009_12.txt
source_filename_12252009_18.txt
What I would like my process flow to do would be to download just these 4 files once daily based on a dynamic ftp script as follows:
open ${Remote.Host}
${Remote.User}
${Remote.Password}
cd ${Remote.RootPath}
prompt off
mget ????????
quit
In DOS batch script you would have the mget command with a wildcard as:
mget source_filename_%DATE:~0,2%%DATE:~2,2%%DATE:~4,4%*.txt
How does one go about implementing this in OWB? Does it require a user defined substitution varilable of some sort?
FYI, I am using version 10gR2.
Cheers.Hi ,
If you are able to achieve your objective from a DOS batch script then you can call that script for an User Defined Activity in OWB process flow .
Hope this helps.
Thanks,
Sutirtha -
Recive a file with dynamic name
Hi All,
I want to receive a file with dynamic name containing date stamp to it.... eg File_20080123.txt , File_20080122.txt etc.
Can anybody suggest how to do it?
Thanks,
AtulAtul,
Are u using mapping program in ur interface? If yes you can go ahead with ASMA + Dynamic Configurations for renaming the file.
Have u tried this option?
See the below Solution
Check the ASMA File for both sender/receiver channels.
Write the below code UDF in mapping program
//Get Input date. Don't pass anything to this UDF except the Date.
//Map the output to the root node of the target.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String fname = conf.get(key);
String ret = fname"_"Date
return "";
raj.
Edited by: Raj on Jan 23, 2008 4:09 PM -
BUG REPORT: Siri couldn't call me with my name
While I was playing with Siri, I came up with this:
I asked this question: "Will it rain this weekend"
Siri didn't get what I said and tried to call me with my name (Sefa), but with some other letters at the end; which I believe is the rest of a tag like [{user}].
Interesting.Hello Makoto181113,
After reviewing your post, it sounds like you are having trouble using Siri and Dictation. I would recommend that you read this article, it may be able to help the issue.
Get help with Siri - Apple Support
Thanks for using Apple Support Communities.
Have a nice day,
Mario -
Call transformation with dynamic table
hi
i uploaded the xml file from application server into a internal table
data : begin of t_x occurs 0,
d type string,
end of t_x.
OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT .
DO.
READ DATASET file INTO t_x-d.
IF sy-subrc <> 0.
EXIT.
ELSE.
append t_x.
clear t_x.
ENDIF.
ENDDO.
CLOSE DATASET filename.
and after i want to call call transformation but i can't put a structure ref to a table like this
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]
because my file xml are not always the same structure.
So is it possible to have a call transformation wit dynamic structure
thanks for your help
sergeHello Serge
If you know what kind of structure you require for your itab you can dynamically create the appropriate itab:
DATA:
gd_struc TYPE tabname,
gdo_data TYPE REF TO DATA.
FIELD-SYMBOLS:
<gt_itab> TYPE TABLE.
* Somehow find the required structure name
gd_struc = 'KNA1'. " for example
* Create data reference with required type (dynamically)
CREATE DATA gdo_dref TYPE (gd_struc).
* Assign the data reference to your field symbol
ASSIGN gdo_data->* TO <gd_itab>.
* NOTE: <gd_itab> has the line structure of 'KNA1'.
Regards
Uwe -
JasperException, calling tag with dynamic data
Hello
I want to call a tag which I have written with dynamic data.
I can call the tag like this, and it works fine
<cm:getCalendar year = "2" week = "51" />But I don't want the input to be hard coded.
Therefor I have tried to insert GET data to the tag like this
<cm:getCalendar year = "<%= request.getParameter("year")%>
" week = "<%= request.getParameter("week")%>" />Or like this
<cm:getCalendar year = "%{#request.yearNr}" week = "%{#request.weekNr}" />The %{#request.yearNr} should be struts 2 specific I think.
In both this cases I get this exception
org.apache.jasper.JasperException: /calendar.jsp(25,0) According to TLD or
attribute directive in tag file, attribute week does not accept any expressions
Is there a way which I could insert data dynamic to my own tag?
Here is the TLD file
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name></short-name>
<tag>
<name>getCalendar</name>
<tag-class>taglib.PrintCalendar</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>year</name>
<required>true/false</required>
</attribute>
<attribute>
<name>week</name>
<required>true/false</required>
</attribute>
</tag>
</taglib>I change the tld to
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name></short-name>
<tag>
<name>getCalendar</name>
<tag-class>taglib.PrintCalendar</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>year</name>
<required>true/false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>week</name>
<required>true/false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib> -
Calling Classes Using Dynamic Names
I've recently been learning ActionScript 3 after have gotten
used to AS2, and I've run into a problem concerning getting
particular MovieClips onto the stage. Calling MovieClips a by
dynamic name was easy using identifiers, but since all MovieClips
are now just classes, I'm unsure how to call them dynamically.
For example:
I have two MovieClips in my FLA file called
"mt_1" and "mt_2". My randomly
chooses either the number 1 or 2 (we'll call the variable
"num") and then it should place the corresponding
MovieClip on the stage. What I have now is clearly not working.
Does anyone have the solution to this?Sorry to follow up on this Answered thread but it seemed
appropriate.
In the above scenario, how would one add something like this:
var thumbRef:Class = getDefinitionByName("shape") as Class;
for (var i:Number = 0; i<6; i++) {
var square
:* = new thumbRef(); // or this["square_"+i]:* = new thumbRef();
master_holder.addChild(this["square_"+i])
How do we beat the simple identifier restriction? -
Import and Export variables with same name
The nco3 throws and exception when a function has Import and Export variables with the same name.
An example is BAPI_BATCH_CREATE.
At the moment my solution is create a ZBAPI_BATCH_CREATE that wraps the original BAPI but has diferent names for import and export variables (IBATCH and OBATCH for BATCH variable).
Anyone has another more clean solution?
VB.NET CODE:
pFunct = foRFCDest.Repository.CreateFunction(fsFunctionName)
This is the error message:
SAP.Middleware.Connector.RfcInvalidStateException was unhandled
Message=Lookup of function BAPI_BATCH_CREATE metadata failed for destination SAPTST
Source=sapnco
StackTrace:
en SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadataClassic(String name)
en SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadata(String name)
en SAP.Middleware.Connector.RfcRepository.GetFunctionMetadata(String name)
en SAP.Middleware.Connector.RfcRepository.CreateFunction(String name)
en SapNetConnectorWrapper.FunctionBase..ctor(RfcDestination foDest, String fsFunctionName) en C:00_Compac201101_LibreriasSapNetConnectorWrapperFunctionBase.vb:línea 11
en SapNetConnectorWrapper.BAPIS.Bapi_Batch_Create..ctor(RfcDestination foDest) en C:00_Compac201101_LibreriasSapNetConnectorWrapperBAPISBapi_Batch_Create.vb:línea 16
en clsEtiquetadoTNPCommon.BLLEtiquetadoTNP.CrearLote(DynamicSqlEntity& foRegCabecera, DynamicSqlEntity& foRegNotificacion) en C:00_Compac201100_EtiquetadoTNP_PTEtiquetadoTNP_PTclsEtiquetadoTNPCommonBLLEtiquetadoTNP.vb:línea 515
en clsEtiquetadoTNPCommon.BLLEtiquetadoTNP.CrearLotesPendientes() en C:00_Compac201100_EtiquetadoTNP_PTEtiquetadoTNP_PTclsEtiquetadoTNPCommonBLLEtiquetadoTNP.vb:línea 602
en WAEtiquetadoTNP.Form1.Timer1_Tick(Object sender, EventArgs e) en C:00_Compac201100_EtiquetadoTNP_PTEtiquetadoTNP_PTWAEtiquetadoTNPForm1.vb:línea 25
en System.Windows.Forms.Timer.OnTick(EventArgs e)
en System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.Run(ApplicationContext context)
en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
en Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
en WAEtiquetadoTNP.My.MyApplication.Main(String[] Args) en 17d14f5c-a337-4978-8281-53493378c1071.vb:línea 81
en System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
InnerException: SAP.Middleware.Connector.RfcInvalidParameterException
Message=Cannot add BATCH to FUNCTION BAPI_BATCH_CREATE: an element with that name already exists
Source=sapnco
StackTrace:
en SAP.Middleware.Connector.RfcContainerMetadata`1.AddElement(T element)
en SAP.Middleware.Connector.RfcFunctionMetadata.AddParameter(RfcParameterMetadata parameterMetadata)
en SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadataClassic(String name)
InnerException:Hi Raul
Even I am getting the same error for below BAPI
Lookup of function BAPI_FAMILY_CREATE metadata failed for destination
Inner Exception: Message "Cannot add EMPLOYEENUMBER to FUNCTION BAPI_FAMILY_CREATE: an element with that name already exists" string
I am using the new NCO 3.0.2.0 x64 version.
Is there any other solution other than creation of Z BAPI. -
I need to include a page with a name I do not know in advance. I can do this with <jsp:include page="${filename}"/>.
Can I also do it somehow using tag files?Atul,
Are u using mapping program in ur interface? If yes you can go ahead with ASMA + Dynamic Configurations for renaming the file.
Have u tried this option?
See the below Solution
Check the ASMA File for both sender/receiver channels.
Write the below code UDF in mapping program
//Get Input date. Don't pass anything to this UDF except the Date.
//Map the output to the root node of the target.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String fname = conf.get(key);
String ret = fname"_"Date
return "";
raj.
Edited by: Raj on Jan 23, 2008 4:09 PM -
Struggling to create reports with dynamic names.... need help
Hi everyone
The reports that I create need to be named with dynamic content from the database. I did try to find if such an option exists in oracle portal, but alas to no avail. My report templates are going to be the same , but as the report content changes so should the report title. Does anyone has a solution to my problem
Thanx in anticipationsorry ..it was silly of me ... i just found out the solution
-
Creating character variable with dynamic length
Hello Experts,
I need to send contents of an internal table via FTP in character mode,
the entire contents of a internal table is concatenated in a string(v_string) which needs to be moved to the character variable of same size say l_count = strlen( v_string ).
can anyone help me to define the character variable say of length l_count.
I have already tried creating a dynamic character variable using CREATE DATA.
eg DATA: dref TYPE REF TO DATA.
CREATE DATA dref TYPE c LENGTH l_count.
but this is not working.
Any response will be helpful.
Thanks & Regards,
Sumukh Kapoor.Hi Marcin,
Thanks for your response,
Reason i need character variable of dynamic length is because the requirement is to send data to client's Windows terminal . We already have FTP code in place and suddenly client has asked to send us data of an internal table in a single line.
I have concatenated the entire table into a string and then thought of moving the entire data from string to that character.. as the size in character goes beyond 60000 characters in many cases....
It seems this is not possible as the string cannot be converted to the data type of variable newly declared.
anyways your input was of great help.
Thanks & Regards,
Sumukh Kapoor.
Edited by: Sumukh Kapoor on Jul 26, 2010 7:56 AM -
Call an array with dynamic name..
Hi there,
Oh, how these syntax problems confuse me !! I just want to create a name dynamically to push to one of multiple arrays.. can someone please correct my syntax ??
var col20:Array = [];
var tempRef:uint = 20;
var gridRef:uint = 360;
var theArray = this["col" + tempRef];
theArray.push(gridRef);hello relaxatraja,
What I need to do is push the value 'gridRef' to the array 'col20' using my 'tempRef' (20) for the dynamic naming of the array, but I'm using Object syntax.
Imagine :-
var col20Array:Array = [];
What I need is ["col" + tempRef + "Array"].push(gridRef);
So the array NAME is dynamic. -
How i validate textbox with dynamic name?.
My form got a dynamic textbox, it may be 0 or 1 or ....10 in
the form based on user action.
Before submitting the form, i want to make sure user enter
value for all textboxs.
How can i validate the text box?.
textbox name item_val_#i#
item_val_1
item_val_n
item_val_ may not be present if user is not adding item_val_
textbox.
Please send me validation javascript.@javagene:
there are so many things wrong with your code that i am not
even going
to bother with listing the errors, especially since Grizzly
has already
done such a nice job of it
just some advice:
learn the basics, man/woman!
the code works fine if - just re-write it correctly! i have
tested it.
fix all the syntax and logic errors you have in your code and
it will work.
tip: learn the syntax/rules of javascript and how call js
functions from
element events
and learn how to nest quotes properly
and also learn some cf basics, especially the
<cfoutput> tag...
and fix your cfif/cfelse logic if you want to see any text
boxes on the
page, never mind in increased numbers...
and while we are at it, learn to read and try out the replies
to your
posts instead of just repeating your question / pleading for
help again
and again in hope of someone getting tired of it and posting
the whole
complete code for you...
@ian:
totally agree with your point. now, where do i send my
invoice to?.. -
Source files with dynamic name
Hi,
Is there a way to load from a variable file name sources, for example file name with date postfix, something like this: INPUT_DEPT_20070313.txt ??
Or i must create an external process in the process flow wich is to rename the file every time to a fix name then load ??
Thanks.Correct. If you are using SQL*Loader mapping, then put a transformation before the mapping in your process flow. If you are using external tables (PL/SQL mapping), then put a premapping procedure in the mapping. And yes, use UTL_FILE package to rename the file.
Greetings,
Mate -
Trouble calling cfmodule with dynamic location
I have the following cfmodule tag running...
<cfset tagpath = #request.localpath#
&membership/EWSTags/EWSTagReach.cfm">
<cfmodule id="EWSTagSearch" template="#tagpath#" >
But when I attempt to run it I get the following error:
The filename, directory name, or volume label syntax is
incorrect
I am not sure what the trouble is. I have output tagpath to
the screen
and the path is correct in every way - including case. Is
there
something wrong with the syntax that you can see?
Thanks,
Chris
Chris Luksha
Echo Web Services
Making Your Website Resound
603-831-0099
http://www.echowebservices.com/
CAN-SPAM Compliant Email Newsletters - only $.05 per
Subscriber
http://www.echowebservices.com/emailYou've got a closing quote without an opening one in your
tagset variable.
Maybe you are looking for
-
Where can i download drivers for windows 7
I own a Pavilion dv6910ea which I bought august 2008. It is currently running on windows vista. But I have got a authentic copy of windows 7 proffesional and want to install it on my laptop. But I cant seem to find and drivers. Can I still use the vi
-
To change the batch value from Purchse requistion in PO
Dear all, I have a batch value in the Purchse requistion and due to generation of reports I need to change the batch value in the PO. When i try to change the batch value system is trowing an error that Batch value different from PR. Please suggest m
-
PHP/MySQL multiple checkbox insert
Hi All, I am creating an order samples page where people can select up to 3 samples. The selected checkboxes will go into a database. How do I insert the selected checkboxes values into a database? I only managed to insert 1 value. Here are the check
-
Performance and HA for HttpClusterServlet
Hi, I didn't see much information in the documentation about the HttpClusterServlet: - can it be (easily) set up in a HA configuration (to avoid it being a SPOF)? - how does it perform? - is it possib
-
[SOLVED] Building fglrx module for 3.11.3-1-ARCH kernel error
I got this error today: 2013-09-28 14:07:59 Building fglrx module for 3.11.2-1-ARCH kernel ... OsVersion says: SMP=1 file /proc/kallsyms says: SMP=1 file /usr/lib/modules/3.11.2-1-ARCH/build/include/generated/autoconf.h says: SMP=1 file /usr/lib/modu