Subscript execution with a variable name
Is the a way to run a subscript where the name is a dynamic variable? for example:
SubtoRun = T1 (T1 is a diadem text variable which is the name of the sub to be run)
Call SubtoRun
Hello Bill
You can use the Execute command, e.g.
sub test
msgbox "hallo"
end sub
t1="test"
execute t1
Hope this helps!
Winfried
Similar Messages
-
How to auto create a global variable with specific variable name in a global vi ?
how to auto create a global variable with specific variable name in a global vi using lv ? Because i need to add a lot of global variable in this global vi. But you know, if i manually add them , it will be a much time-costing work. So i want to use someway to auto generate ? Can i ?? Thanks a lot !
Hi
what aartjan is saying is the way for you. but you can develop an utility which will actually help you create global variables. To get the details on this just have a look at VI Scripting section on LAVA forum.
But i would like you to suggest few things
1. If your programs have so many global variables (Thats why u want utility) then you should take out some time to read about LabVIEW design patterns. I think if programmer follows these practicess he dont need a single global variable.
2. Their are some other ways to achieve similar functionality as of global variables (Uninitialized Shift Registers, Single Element Qs and so on) but they are much faster than global variables.
I am Attaching Whatever Resources i am having I will also attach the template of the design pattern i generaly use in short duration
Message Edited by Tushar Jambhekar on 10-06-2005 07:33 PM
Message Edited by Tushar Jambhekar on 10-06-2005 07:36 PM
Tushar Jambhekar
[email protected]
Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog
Attachments:
LabVIEWDesignPatterns.zip 1505 KB
Large_Code_Implementation.zip 522 KB
Database Tests.zip 868 KB -
Search/Replace for/with php variable name
Hi all.
I have just updated from Dreamweaver 5 to 5.5 and now I am missing a very handy functionality.
What I want to do is to replace all occurences of $a with $b.
In Dreamweaver 5 that was very easy by using "Find and replace":
Find in: All open documents
Search: Sourcecode
Find: $a
Replace: $b
Active options: Match case and Match whole word !!!!
Now in Dreamweaver 5.5 the option "Match whole word" is automatically disabled as soon as I enter a $ (dollar) in the search field.
I assume this has something to do with regular expressions but I do NOT check the option "Regular expression" in the search and replace dialog.
Is this a bug?
What are my options now.
If I don't have the possibility to to tick "Match whole word" my search does also replace all occurrences of $abc and $answer etc. with $b.
Thank you for your helpsamet2011 wrote:
I have Dreamweaver 5 and 5.5 running parallel on my computer.
I can confirm that the way I described and used to use is working on Dreamweaver 5.
I was the person who informed Murray that Dreamweaver CS5 and CS5.5 both behave the same way. I have just checked as far back as CS3, and it also disables "Match whole word" when you enter a dollar sign in the Find field of the Find and Replace dialog box. In fact, that option is disabled whenever you enter any nonalphanumeric character (except an underscore) in that field. It's not limited to dollar signs.
Why it's not disabled in your version of CS5 is a mystery.
However, to solve your problem, you don't need either a regex or "Match whole word". Simply type the name of your PHP variable followed by a space into the Find field. Also add a space after the name of the variable you're using as the replacement.
What "Match whole word" does under the hood is to use a regular expression to find a word break. As long as you leave a space between your variables and any following code, simply adding the space to your search will do the trick.
However, if you have cases where a variable is followed by a comma, closing parenthesis, or some other character, you will need to use the following regex:
Find: \$variable_name\b
Replace: $new_name
The \$ looks for a dollar sign. The variable_name matches the literal text of the variable name (replace it with the actual text you're looking for). The \b matches a word break in exactly the same way as "Match whole word".
In the Replace field, $new_name is the literal name of the new variable. -
How to create a PDF with a variable name
I am a new user and i need a suggestion.
I need to create a PDF file with a name that is a variable.
I extract some data from SAP and i want use the "Offer number" to call my file.
Wher i have to past my "variable" to the OutputFileName?
Thanks
JeixThis isn't an Output Designer question but an Output Server question. Anyway, see the subject titled "Dynamic pdf filename creation from form data content", currently about 13 subjects before yours.
http://www.adobeforums.com/webx/.59b585c2/0 -
Can't create float array with a variable name as size parameter?
Hi,
When trying to compile code that users a variable in the array subscript to set the size, CC gives the following error:
Error: An integer constant expression is required within the array subscript operator.
1 Error(s) detected.The code is as follows:
int main()
//blah blah
const int arrSize = numberVariables;
float tempArr[arrSize];
//blah blah
}Output from CC -V:
unknown% CC -V
CC: Sun C++ 5.9 SunOS_i386 Patch 124864-01 2007/07/25Output from uname -a:
unknown% uname -a
SunOS unknown 5.10 Generic_137138-09 i86pc i386 i86pcAny ideas on why CC is giving that error?
~Slow
Edited by: SlowToady on Nov 15, 2008 8:28 PM
Edited by: SlowToady on Nov 15, 2008 8:36 PMMarc_Glisse wrote:
Last time I checked, I did not see VLAs in the draft of the next C++ standard, which I believe is now feature complete. So either I missed it (quite possible) or VLAs were considered a bad idea (for C as well many people consider alloca and VLA bad ideas). It is however a very reasonable extension to have (care to file a RFE?).The following code performs like this on an IBM x366 with 4 single-core 3.16 GHz Xeons, running OpenSolaris build 96:
-bash-3.2$ ./thrtest
malloc() took 440895924 ns
alloca() took 2122522 ns
-bash-3.2$Using alloca is two hundred times faster.
Two hundred times faster.
Think about that next time some pedant says alloca "sucks".
Try for yourself. Here's the code:
#include <stdlib.h>
#include <pthread.h>
#include <alloca.h>
#include <strings.h>
#include <stdio.h>
#define NUM_THREADS 8
#define ITERS 10000
#define BYTES 1024
typedef void ( *mem_func_t )( void );
void alloca_iter()
char *ptr;
ptr = ( char * ) alloca( BYTES );
memset( ptr, 0, BYTES );
return;
void malloc_iter()
char *ptr;
ptr = ( char * ) malloc( BYTES );
memset( ptr, 0, BYTES );
free( ptr );
return;
void *thread_proc( void *arg )
mem_func_t mem_iter;
mem_iter = ( mem_func_t ) arg;
for ( int ii = 0; ii < ITERS; ii++ )
mem_iter();
return( NULL );
int main( int argc, char **argv )
pthread_t tids[ NUM_THREADS ];
void *results[ NUM_THREADS ];
hrtime_t start;
hrtime_t end;
int ii;
start = gethrtime();
for ( ii = 0; ii < NUM_THREADS; ii++ )
pthread_create( &tids[ ii ], NULL, thread_proc, malloc_iter );
for ( ii = 0; ii < NUM_THREADS; ii++ )
pthread_join( tids[ ii ], &results[ ii ] );
end = gethrtime();
printf( "malloc() took %ld ns\n", end - start );
start = gethrtime();
for ( ii = 0; ii < NUM_THREADS; ii++ )
pthread_create( &tids[ ii ], NULL, thread_proc, alloca_iter );
for ( ii = 0; ii < NUM_THREADS; ii++ )
pthread_join( tids[ ii ], &results[ ii ] );
end = gethrtime();
printf( "alloca() took %ld ns\n", end - start );
return( 0 );
} -
C:set with dynamic variable name
Hello,
we have a litte market system.
we iterate over the articles to display them on a page
foreach article type we have to include a popup, but only once foreach article type.
So if we have more than one article of the same type, the popup should be included only one time.
<c:forEach var="article" items="#{MyArticleController.entities}">
<c:if test="${requestScope[article.dtype] != true}">
<!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/> -->
<c:set scope="request" var="${article.dtype}" value="1" />
</c:if>
<!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
</c:forEach>I think the line with the c:set seems to be the problem.
How can I solve this problem. How can I set a dynamic value and test against it later?
Thanks
DirkYou were close with your first example.
However as noted, the <c:set> tag doesn't accept a dynamic expression for the "var" attribute.
Suggested alternative: instead of using request attributes, have a seperate map
<jsp:useBean id="articleTypeUsed" class="java.util.HashMap"/>
<c:forEach var="article" items="#{MyArticleController.entities}">
<c:if test="${not empty articleTypeUsed[article.dtype]}">
<!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/> -->
<c:set target="${articleTypeUsed}" property="${article.dtype}" value="1" />
</c:if>
<!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
</c:forEach>That should solve your issue with translating this java code into jstl.
Whether the mix of JSTL and JSF/ui will work well together is a completely seperate issue, and one I can't really help with. -
Error while using the variable name "VARIABLE" in variable substitution
Hi Experts,
I am using variable substitution to have my output filename set as a payload field value. It is working fine when I am using the variable name as fname, subs etc but channel goes in error when I am using the variable name as "VARIABLE". This is probably a reserved word but i would like to know where i can find a detailed documentation on this. Say things to note / restrictions while using variable substitution.
This is the error in the channel:
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table
Thanks,
DiyaHi Zevik,
Thanks for the reply. The output file is created correctly by merely changing the variable name to something else and hence the doubt.
Below is the configuration:
Variable Substituition
VARIABLE payload:interface_dummy,1,Recordset,1,Header,1,field1,1
Filename schema : TEST_%VARIABLE%.txt
Output xml structure:
<?xml version="1.0" encoding="utf-8" ?>
- <ns:interface_dummy xmlns:ns="http://training.eu.unilever.com">
- <ns:Recordset xmlns:ns="http://training.eu.unilever.com">
- <Header>
<identifier>HDR</identifier>
<field1>001</field1>
<field2>001</field2>
<field3>R</field3>
</Header>
- <Detail>
<identifier>A</identifier>
<field1>000000002</field1>
<field2 />
<field3>Doretha.Walker</field3>
</Detail>
I thimk my configuration is correct as it is working correctly with the variable name change, However, maybe i missed something ! -
Actionscript variable name function call
I'm attempting to call a function dynamically using a string variable. I know that to normally do this, I would use code like the following:
var functionName:String = "ii_" + currentItem.id;
var myData:Array = this[functionName](parameter1, parameter2, parameter3);
However, my function is actually in another flex directory/package called UploadApps.customUploadFunctions. I've tried this sort of thing:
var functionName:String = "ii_" + currentItem.id;
var myData:Array = UploadApps.customUploadFunctions.this[functionName](parameter1, parameter2, parameter3);
but this doesn't work. Any ideas on how I go about calling a function with a variable name in another package?
JohnThanks Alex. The function in the package is defined as:
package UploadApps.customUploadApps
public function ii_000010(inputItem:InputItem, periodDates:Object, inputItemBox:VBox, branchId:int, uploadStatusData:ArrayCollection, validatorArray:Array):Array {
with the file name being ii_000010.as, but when I call it as such:
import UploadApps.customUploadApps.*;
var functionName:String = "ii_" + currentItem.id;
someArray = UploadApps.customUploadApps[functionName](currentItem, thisFieldDates, inputItemBox, BranchId, uploadStatusData, validatorArray);
I get the errors:
1120: Access of undefined property UploadApps.customUploadApps.
1182: Package cannot be used as a value: UploadApps.customUploadApps.
John -
What is $var variable name usage?
Hi all,
Good day.
In SAP standard program, I saw some variable declared with prefix dollar sign.
example, $lt_var
Any different with normal variable name?
Thanks.
Greatly appreciate for any comment.Hi,
good question but unfortunately I do not have direct answer. But I am very interested in answer. I found this about variable naming in ABAP documentation.
As well as these characters, certain special characters are used internal. However, these should not be used in application programs.
and in ABAP objects you can use only
Permitted are letters from "A" to "Z", numbers from "0" to "9" and underscores (_).
So my guess is that it should be related to special characters. Maybe passing some hints to ABAP compiler.
Cheers -
I need to run a SQL command in one of the step in my procedure where I need to run command like >>>> Delete from TableA where Column1 LIKE 'MY_VAR' but while running its not substituting the value of MY_VAR.....Any clue how can I run command like this where I have refresh the variable before executing the procedure in the package so variable is declared before procedure execution.I dont wanna refresh the variable with Quotes around because I am using this variable in different places. Any clue how can I put quotes around MY_VAR in Like stament.
I have also tried this>> Delete from TableA where Column1 LIKE '''MY_VAR''' but still variable value is not substituting.The substituted variable will never appear in the log, how are you figuring out it does not get substituted?
In the syntax, you should use something like the following:
Delete from TableA where Column1 LIKE '#MY_VAR'If you use the expression editor to do select the variable name, it should ensure that it is put in correctly. To see if it is actually recognised, in the log, you should see
Delete from TableA where Column1 LIKE '#MyProject.MY_VAR'Craig -
SQL query with Bind variable with slower execution plan
I have a 'normal' sql select-insert statement (not using bind variable) and it yields the following execution plan:-
Execution Plan
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=7 Card=1 Bytes=148)
1 0 HASH JOIN (Cost=7 Card=1 Bytes=148)
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=4 Card=1 Bytes=100)
3 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=3 Card=1)
4 1 INDEX (FAST FULL SCAN) OF 'TABLEB_IDX_003' (NON-UNIQUE)
(Cost=2 Card=135 Bytes=6480)
Statistics
0 recursive calls
18 db block gets
15558 consistent gets
47 physical reads
9896 redo size
423 bytes sent via SQL*Net to client
1095 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
55 rows processed
I have the same query but instead running using bind variable (I test it with both oracle form and SQL*plus), it takes considerably longer with a different execution plan:-
Execution Plan
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=407 Card=1 Bytes=148)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=3 Card=1 Bytes=100)
2 1 NESTED LOOPS (Cost=407 Card=1 Bytes=148)
3 2 INDEX (FAST FULL SCAN) OF TABLEB_IDX_003' (NON-UNIQUE) (Cost=2 Card=135 Bytes=6480)
4 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=2 Card=1)
Statistics
0 recursive calls
12 db block gets
3003199 consistent gets
54 physical reads
9448 redo size
423 bytes sent via SQL*Net to client
1258 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
55 rows processed
TABLEA has around 3million record while TABLEB has 300 records. Is there anyway I can improve the speed of the sql query with bind variable? I have DBA Access to the database
Regards
IvanMany thanks for your reply.
I have run the statistic already for the both tableA and tableB as well all the indexes associated with both table (using dbms_stats, I am on 9i db ) but not the indexed columns.
for table I use:-
begin
dbms_stats.gather_table_stats(ownname=> 'IVAN', tabname=> 'TABLEA', partname=> NULL);
end;
for index I use:-
begin
dbms_stats.gather_index_stats(ownname=> 'IVAN', indname=> 'TABLEB_IDX_003', partname=> NULL);
end;
Is it possible to show me a sample of how to collect statisc for INDEX columns stats?
regards
Ivan -
Using variable with the same name as field name?
I have a complex proc where I have variables with the same name as field name used on a query. something like this:
SELECT a.id_table WHERE a.id_table = id_table
where the last id_table is a parameter sent to the proc:
declare procedure myproc(id_table int)
Is there any way or notation to declare the variable inside the query as a variable or I have to use a different name?Well, variables are not the only thing you have to change if you want to switch to Oracle.
Although I don't think it is good practice (to use variable name same as column name), here is one example how you can achieve it using EXECUTE IMMEDIATE and bind variable
SQL> select deptno, count(1)
2 from scott.emp
3 group by deptno;
DEPTNO COUNT(1)
30 6
20 5
10 3
SQL> set serveroutput on
SQL> declare
2 deptno varchar2(10);
3 i number;
4 begin
5 deptno:=10;
6 execute immediate
7 'select count(1) from scott.emp where deptno=:deptno' into i using deptno;
8 dbms_output.put_line('OUT ---> '||i);
9 end;
10 /
OUT ---> 3
PL/SQL procedure successfully completed.
SQL> Message was edited by:
tekicora
Message was edited by:
tekicora -
How to declare internal table in BADI with variable name beginning with 0..
Gurus,
How to declare an internal table within a BADI. I have to implement a BADI UC_TASK_CUSTOM for BCS to BW load and there i have to declare an internal table like:
TYPES: BEGIN OF t_cube_data,
0cs_version TYPE /bi0/oics_version,
0sem_cgcomp TYPE /bi0/oisem_cgcomp,
bcs_vers TYPE /bic/oibcs_vers,
bcs_lcus TYPE /bic/oibcs_lcus,
bcs_ldch TYPE /bic/oibcs_ldch,
bcs_invcom TYPE /bi0/oibcs_invcom,
bcs_litem TYPE /bic/oibcs_litem,
bcs_llob TYPE /bic/oibcs_llob,
bcs_lmay TYPE /bic/oibcs_lmay,
0move_type TYPE /bi0/oimove_type,
pcompany TYPE /bi0/oipcompany,
bcs_lprg TYPE /bic/oibcs_lprg,
figlxref3 TYPE /bic/oifiglxref3,
fiscyear TYPE /bi0/oifiscyear,
fiscper3 TYPE /bi0/oifiscper3,
fiscvarnt TYPE /bi0/oifiscvarnt,
curkey_gc TYPE /bi0/oicurkey_gc,
unit TYPE /bi0/oiunit,
cs_trn_gc TYPE /bi0/oics_trn_gc,
cs_trn_qty TYPE /bi0/oics_trn_qty,
END OF t_cube_data
But with this declaration it gives a error saying that u cannot have a variable beginning with 0...like 0cs_version....
but i have to do it for my functionality to wrk...
Please help me do it....
how can i declare a internal table that allows me to have variable names that start with 0....
Please help....Its URGENT....
Thanks
SamMurali,
I need to have 0 before the variable name in the declaration of the internal table....how can i attain that....
Please suggest...
Thanks
Sam -
Problem with variable name in ZXRSRTOP include (virtual KF)
Hi all,
I am coding a routine to use a virtual key figure in the BEx.
I have just a little problem with the name of a variable:
as explained in the documentation, I created the variable with the prefix G_POS_, the name of the infocube and the name of the infoobject all together:
DATA: G_POS_BC_ST_003_C_DIV__C_COMPAR type i.
The problem is that this variable name is longer than 30 characters, so the system doesn't accept it.
Is there a workaround, other than changing the name of the infoobject (which is a navigational attribute)?
Any help would be appreciated.
LoïHello Marc,
I understand that I have to use a concatenate function and a dynamic call of the variable with (variable) instruction, but i do not understand how to implement it.
the infocube name is BC_ST_003
the characterisdtic name is C_DIV__COMPAR
So, in the include ZXRSRTOP the statement
DATA : G_POS_BC_ST_003_C_DIV__COMPAR
does not work due a length problem (see first post)
But in the same include the statement
+DATA: l_global_name type c.
concatenate 'GPOS' 'BC_ST_003' 'C_DIV__C_COMPAR' into l_global_name separated by '_'.+
drives to the following error : statement is not accessible.
Could u please provide me with an example of the code in the include ZXRSRTOP, and in the include ZXRSRZZZ for the use of this variable.
Thanks in advance.
Loï -
Text variable replacementpath with key, attribute, name then what
text variable replacementpath with key, attribute, name then what are the changes in my report in quary designer
The XML 1.0 spec does not allow elements or attribute names to include spaces in the names.
See: http://www.xml.com/axml/axml.html
for a nice annotated version of the spec.
[Definition:] A Name is a token beginning with a letter or one of a few punctuation characters, and continuing with letters, digits, hyphens, underscores, colons, or full stops, together known as name characters. Names beginning with the string "xml", or any string which would match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for standardization in this or future versions of this specification.
Maybe you are looking for
-
Error Message when trying to open a pdf
Recently tried opening a downloaded user manual and received the following message: There was an error opening this document. There was a problem reading this document (14). Please note: Have installed latest version of reader (10). Have tried down
-
Lyrics Tab is Missing in iTunes 12
The lyrics tab is missing in iTunes 12. Many of my podcasts use that to list the tracks for long mixes. I can open those podcasts in a 3rd party player & access the data still. Why is it gone now?
-
Release order with reference to Contract.
Hello all Client is using the quantity contract & against that Release order are created ,after changing the contract price, new release order will pick up new price from contract, Now the requirement is Old release order(GRN & INVOICE NOT DONE) pric
-
How do I get a Connect Training Course to update my Captivate Presentation Version?
I am using a presentation with quiz created in Adobe Captivate 5. I am using this as a online training course on Adobe Connect. I published the first two versions, which are reflected in user reports in Connect. However, I have made some important
-
I manage to FaceTime on "3G" network. I did it with the new iPad (64GB wifi) while connected (via hotspot) to my iPhone 4. The iPhone 4 itself was on 3G network. I guess the iPad 'thinks' it was on wifi, thus enabling the FaceTime. The iPhone's 3G si