Use variable for symbol name
I am trying to reference a symbol element that looks like this:
elementName = variableName + "Menu";
var menuChoice = sym.getSymbol('printMenu').$(elementName);
when I console.log ("menuChoice" + menuChoice) I get
object Object
How do I accomplish using a variable as a symbol name?
Yes. I have a function that does a number of things so I am not looking to rewrite the menu Symbol.
Similar Messages
-
How can we use variables for instance name?
I'm using 9 textbox in my stage. Names are similar, only difference is the last character. (s1_0, s1_1, s1_2, ...). I'm trying to use these textbox in a loop. But I couldn't find the right typing... s1_[i], s1_(i) or s1_{i} gives error.
s1_0.text=0
s1_1.text=0
s1_2.text=0
s1_3.text=0
s1_4.text=0
s1_5.text=0
s1_6.text=0
s1_7.text=0
how can make the shortest typing for this issue?yes, its working, thank you very much...
I tried array operator but the word "this"..
what does it means ? when I delete this word, it gives error. how does flash know that it is a instance name? -
Help with using variable for name of table in PLSQL block...
I am trying to use a variable for the name of a table but getting errors ...i am sure I am close to the correct form here but something is wrong. I sure would appreciate some help!
DECLARE
ln_month Number;
ln_day Number;
ln_year Number;
ls_year VarChar2(4);
ls_prev_table VarChar2(30);
ls_cur_table VarChar2(30);
ln_prev_year Number;
ls_prev_year VarChar2(4);
ln_prev_month Number;
BEGIN
Select To_Number(To_Char(sysdate, 'MM')) into ln_month from dual;
Select To_Number(To_Char(sysdate, 'DD')) into ln_day from dual;
Select To_Number(To_Char(sysdate, 'YYYY')) into ln_year from dual;
If ln_month = 01 Then
ls_cur_table := "T_CPRS_FDW_CUR_JAN_ACTUALS";
ls_prev_table := "T_CPRS_FDW_PREV_DEC_ACTUALS";
ln_prev_year := ln_year - 1;
/***above is where I am trying to use variables for assignement to years and months tables***//// ln_prev_month := 12;
End If;
/*------MORE IF STATEMENTS FOR EACH MONTH ---OF --THE YEAR ...AND its the following 2 variable statements that the compiler doesnt like! */
If ln_day < 20 Then
Delete from :ls_prev_table;
INSERT INTO :ls_prev_table /*(STUFF TO BE INSERTED GOES HERE)*/
HELP PLEASE!
nullHi,
The parser does not under variables directly in dml statements.u need to form a statement and the parse and execute the same...
so the soln is
Declare
lv_stmt varchar2(250);
Begin
lv_stmt := 'Delete from '| |ls_prev_table;
execute immediate lv_stmt;
-- Same is the case with the insert stmt--
End;
This should solve ur problem.
u could also give a direct call like
execute immediate 'Delete from '| |ls_prev_table ;
Note: This statement "execute immediate" holds good for oracle versions 8.x and above which makes the stmt very simple. For lower version u need to use the dbms_sql package to parse and execute the statement which has a series of statements for the same.
Kiran -
Hi All,
I am new to TestStand. Still in the process of learning it.
What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?
Thanks in advance,
LaVIEWan
Solved!
Go to Solution.Hi,
Using the Parameters is the correct method to pass data into and out of a sub sequence. You assign your data to be passed into or out of a Sequence when you are in the Edit Sequence Call dialog and in the Sequence Parameter list.
Regards
Ray Farmer -
Using variables for answers to fill-in-the-blank questions
Hello,
For fill-in-the-blank questions, one has to provide answers. I want to provide these in the form of (user-created) variables, rather than in the form of fixed strings of characters (so then, as $$var1$$ rather than as 'rabbit'). I haven't been able to get this to work. The enter variable function is indeed available (in the properties panel), but it doesn't actually work (i.e. even if you select a variable to be entered, it doesn't actually get entered).
Is there a way around the problem?
1. NB that this same issue holds for text entry boxes (rather than fill-in-the-blank questions). If I could get this to work for text entry boxes, I would use them rather than fill-in-the-blank questions.
2. One can use variables for answers to multiple choice questions. So I'm hoping I can get it to work for fill-in-the-blank questions as well.
Thank you in advance. Marvin DuBoisThat would have been my suggestion. I don't have a dedicated blog post, but use TEB's for that kind of questions myself as well. And contrary to the widget/interaction I mentioned before, a TEB is an interactive object, which means it can be validated and there can be a score attached to it. But, it will not help you, since you have to add the correct answers in the same way as for a dropdown list in the FIB question (they are sort of TEB's there). And it is that list that doesn't allow to enter a variable instead of a fixed sequence of characters.
Which means that you are back to the advanced actions, same as in my blog posts with the widget/interaction.
Have a workaround (after all I am the workaround Queen) to have reporting, if you need to check only one TEB, described here:
http://blog.lilybiri.com/report-custom-questions-part-2
The idea is to use another interactive object that can have a score. In reality I use two instances of that same object: one with score 0 and one with score X and show the right one depending on the conditional action.
However if you want to have multiple TEB's on the same slide, that have to be checked all with the same advanced action, than you'll need either the Mastery widget by InfoSemantics (only for SWF output) or Javascript.
Lilybiri -
Using variables as table names. Ideas for alternative designs
Hi,
I am designing an application which uses synonyms to pull information from 'client' DBs via DB Links. The synonyms are created with a DB_ID in the name (example: CUSTOMER_100, CUSTOMER_200... where 100 and 200 are DB IDs from 2 separate client DBs.
I have a procedure which selects data from the synonym based on what DB_ID is passed to the procedure. I want to be able to run this one procedure for any DB_ID that is entered. I am now aware I cannot use variable names for table names and using EXECUTE IMMEDIATE doesnt seem to fit for what I am trying to do.
Does anybody have any suggestions or re-design options I could use to achieve this generic procedure that will select from a certain synonym based on the DB info input parameters? Thanks.
CREATE OR REPLACE PROCEDURE CUSTOMER_TEST(p_host IN VARCHAR2, p_db_name IN VARCHAR2, p_schema IN VARCHAR)
IS
v_hostname VARCHAR2 (50) := UPPER (p_host);
v_instance VARCHAR2 (50) := UPPER (p_db_name);
v_schema VARCHAR2 (50) := UPPER (p_schema);
v_db_id NUMBER;
v_synonym VARCHAR2(50);
CURSOR insert_customer
IS
SELECT
c.customer_fname,
c.customer_lname
FROM v_synonym_name c;
BEGIN
-- GET DB_ID BASED ON INPUT PARAMETERS
select d.db_id
into v_db_id
from t_mv_db_accounts ac,
t_mv_db_instances i,
t_mv_dbs d,
t_mv_hosts h
where ac.db_ID = d.db_ID
and i.db_ID = d.db_ID
and i.HOST_ID = h.host_id
and upper(H.HOST_NAME) = v_hostname
and upper(D.DB_NAME) = v_instance
and upper(Ac.ACCOUNT_NAME) = v_schema;
--APPEND DB_ID TO THE SYNOYNM NAME
v_synonym := 'CUSTOMER_'||v_db_id;
FOR cust_rec IN insert_customer
LOOP
INSERT INTO CUSTOMER_RESULTS (First_Name, Last_Name)
VALUES (cust_rec.customer_fname, cust_rec.customer_lname);
END LOOP;
COMMIT;
END;
Rgs,
RobHi
rules engine style with table that holds the logic or code SQL directly in the procedure and IF THEN ELSE with db_id. Latter is better because SQL is native and objects are checked every time procedure is compiled.
James showed the simplest way but this rather complex way gives you more flexibility between instances if ever needed.
CREATE TABLE synonym_dml(db_id number not null primary key, sql_text clob)
INSERT INTO synonym_dml VALUES (100, 'INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer100')
INSERT INTO synonym_dml VALUES (200, 'INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer200')
set serveroutput on size unlimited
create or replace
PROCEDURE Execute_Synonym_Dml(p_host VARCHAR2, p_db_name VARCHAR2, p_schema VARCHAR) IS
BEGIN
FOR r IN (
SELECT sql_text FROM synonym_dml
-- WHERE db_id IN (
-- SELECT d.db_id
-- FROM t_mv_db_accounts ac, t_mv_db_instances i, t_mv_dbs d, t_mv_hosts h
-- WHERE ac.db_id = d.db_id
-- AND i.db_id = d.db_id
-- AND i.host_id = h.host_id
-- AND upper(h.host_name) = p_hostname
-- AND upper(d.db_name) = p_instance
-- AND upper(ac.account_name) = p_schema
LOOP
DBMS_OUTPUT.PUT_LINE('-- executing immediately ' || r.sql_text);
--EXECUTE IMMEDIATE r.sql_text;
END LOOP;
END;
create or replace
PROCEDURE Execute_Synonym_Dml_Too(p_host VARCHAR2, p_db_name VARCHAR2, p_schema VARCHAR) IS
PROCEDURE DB_ID_100 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('-- executing DB_ID_100');
--INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer100;
END;
PROCEDURE DB_ID_200 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('-- executing DB_ID_200');
--INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer200;
END;
BEGIN
FOR r IN (
SELECT 100 db_id FROM dual
-- SELECT d.db_id
-- FROM t_mv_db_accounts ac, t_mv_db_instances i, t_mv_dbs d, t_mv_hosts h
-- WHERE ac.db_id = d.db_id
-- AND i.db_id = d.db_id
-- AND i.host_id = h.host_id
-- AND upper(h.host_name) = p_hostname
-- AND upper(d.db_name) = p_instance
-- AND upper(ac.account_name) = p_schema
LOOP
IF (r.db_id = 100) THEN
DB_ID_100;
ELSIF (r.db_id = 200) THEN
DB_ID_200;
ELSE
RAISE_APPLICATION_ERROR(-20001, 'Unknown DB_ID ' || r.db_id);
END IF;
END LOOP;
END;
EXECUTE Execute_Synonym_Dml('demo','demo','demo');
EXECUTE Execute_Synonym_Dml_Too('demo','demo','demo');
DROP TABLE synonym_dml PURGE
DROP PROCEDURE Execute_Synonym_Dml
table SYNONYM_DML created.
1 rows inserted.
1 rows inserted.
PROCEDURE EXECUTE_SYNONYM_DML compiled
PROCEDURE EXECUTE_SYNONYM_DML_TOO compiled
anonymous block completed
-- executing immediately INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer100
-- executing immediately INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer200
anonymous block completed
-- executing DB_ID_100
table SYNONYM_DML dropped.
procedure EXECUTE_SYNONYM_DML dropped. -
Using variables for function arguments AS2
Hello,
I am trying to create a function in AS2.
After creating the function, I want to use values stored in variables for the function arguments rather than manually typing static values for carrying out the function calculation. Also, I want to use the function to assign a new value to the existing variable.
I have asked a similar question 2 days ago here and got the answer (thank you), but now I got one more question - How can I create the function to assign a value to the variable while that variable itself is also a function argument?
For example, I have 6 numeric variables:
var CoinA:Number = 10;
var CoinB:Number = 20;
var CoinC:Number;
var CoinD:Number = 30;
var CoinE:Number = 40;
var CoinF:Number;
Then I tried to create a function to assign values to variables CoinC and CoinF:
function CalculationA(FirstCoin, SecondCoin, ThirdCoin):Void {
FirstCoin = SecondCoin + ThirdCoin;
CalculationA(CoinC, CoinA, CoinB);
CalculationA(CoinF, CoinE, CoinF);
The above code didn't really assign the values 30 and 70 to the variables CoinC and CoinF but instead, values of CoinC and CoinF are undefined.
Please give me the correct code if there's a correct way of doing this.
Thank you,Here is one way of doing it, by passing a string value of the variable name instead of the actual variable name....
var CoinA:Number = 10;
var CoinB:Number = 20;
var CoinC:Number;
var CoinD:Number = 30;
var CoinE:Number = 40;
var CoinF:Number;
function CalculationA(FirstCoin, SecondCoin, ThirdCoin):Void {
this[FirstCoin] = SecondCoin + ThirdCoin;
CalculationA("CoinC", CoinA, CoinB);
CalculationA("CoinF", CoinD, CoinE);
(Note that in your second function call I changed the coins since CoinF (ThirdCoin) is undefined at that point.) -
How can I use variable for a package filename and target file inODIFileMove
I want to use a variable for paths so that when I migrate from Dev to QA to Prod I don't have to do a lot of editing.
Specifically, I want a variable to be the first part of the path for the filename (\\sundev1\fnd1-hypd1) and join this with the rest (\update\log\*.log or specific filename) using several different objects like the ODIFileMove, ODI OS Command, OS Command, etc.
Thank you!Hi,
you could set up a database table holding processing parameters (i.e. Column1 - ParamName, Column2 - ParamValue).
One row could then be ParamName = FilePath, ParamValue = \\<server>\folder\
So, the refreshing query (attached to a logical schema) would be something like SELECT ParamValue FROM <your table> WHERE ParamName ='FilePath'
Then, create a variable which can refresh from the database and in the package, drop the variable onto the flow and set it's type to 'Refresh Variable' in the properties.
Hope this helps.
geeo -
System variable for Warehouse name in Pick list PLD
Hi Experts,
My customer would like to show the Warehouse name on the Pick List print layout.
What is the System Variable to display the Warehouse name on the Pick List?. Iu2019m working with Sap Business One 2007A.. Where can I find the system variables for Chile localization. Thanks Very Much
ClaudiaHi Claudio,
Try this,
->> Open the Pick List(System) PLD and Save as the New PLD.
->> Open the NEw PLD and Create 1 Database Field(for WareHouse Name) in Repetetive Area.
Table -> OWHS - WareHouse
Column -> WhsName - WareHouse Name
Save as and Run the Print Preview.
IF will not print the WareHouse Name in Print.
Do this in PLD.
->> Open your PLD.
--> Ralate to WareHouse Code Field ID in WareHouse Name Field at Content Tab on Properties Window.
Regards,
Madhan. -
SPSiteDataQuery - filter by file Title - Can I use variable for the filter value?
I use SPsiteDataQuery to search across multiple lists and filter by file title. I have the file title information in a variable.
Can I use variable in the filter value?
string fileName = "Policies.doc"
SPSiteDataQuery spQry = new SPSiteDataQuery();
spQry.ViewFields = "<FieldRef Name='Title'/><Value Type='Text'>fileName</Value>"If I have understood correctly, you want to search based upon a File title in all the sites. You can include a query to filename in the spQry
spQry.Query = "<Where>" +
"<Eq>" +
"<FieldRef Name=\"FileLeafRef\"/>" +
"<Value Type=\"Text\">" + fileName + "</Value>" +
"</Eq>" +
"</Where>";
get2pallav
Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you. -
Using variables for column headings in REUSE_ALV_GRID_DISPLAY
Hi Everyone,
Is it possible for me to display the column heading in REUSE_ALV_GRID_DISPLAY using a variable?
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 13.
ls_fieldcat-reptext_ddic = LWOP1. " <===Here is my variable for my
column heading
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'LWOP2'.
ls_fieldcat-datatype = 'CURR'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
Please help me. Thanks in advance.for me isfielldcat-seltext_l = v_heading. working properly .
i think you cant give
ls_fieldcat-reptext_ddic = LWOP1.
but i m not sure.
regards
shiba dutta -
Use variables inside MovieClip names to call them in ASP 3.
This line of code works fine for me:
this.helpB1Btns.helpB1B3.alpha = 0.3;
But I wonder how can I use variables instead of numbers ( 1 and 3 ) above??
I mean for example:
var i:int = 1;
var j:int = 3;
this["helpB"+i+"Btns.helpB"+i+"B"+j+".alpha"] = 0.3; //Error
["helpB"+i+"Btns.helpB"+i+"B"+j+".alpha"] = 0.3; //Error
this["helpB"+i+"Btns"].["helpB"+i+"B"+j+".alpha"] = 0.3; //Error
For instance, this code works fine:
this["helpB"+i+"Btns"].alpha = 0.3;
(this.helpB1Btns.alpha = 0.3;)
But I have no idea to code this:
this.helpB1Btns.helpB1B3.alpha = 0.3;
I appreciate your help or any refference I could learn this fundamentally?
yours,
Aliahhhhhhh......I was only one DOT wrong and trying different methods for HALF AN HOUR!! lol
I wish Flash was more intelligent to correct such small mistakes!!
Thank you SO MUCH for your reply -
Using a Variable for Table Name with a cursor
Hello All
Is it possible to use a Parameter passed to a procedure as the table name
in a cursor selection statment. I thought the below would work but I get
a error. Does anyone have any ideas?? The Error is listed below to.
Here's the code I just complied
CREATE OR REPLACE PROCEDURE Dup_Add(NEWQATABLE IN VARCHAR2) IS
CURSOR c1 IS SELECT MUNI,PROV FROM NEWQATABLE GROUP BY MUNI, PROV;
c1rec c1%ROWTYPE;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO c1rec;
EXIT WHEN c1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(c1rec.MUNI);
END LOOP;
CLOSE c1;
END;
Here is the errors
LINE/COL ERROR
3/8 PLS-00341: declaration of cursor 'C1' is incomplete or malformed
3/15 PL/SQL: SQL Statement ignored
3/38 PLS-00201: identifier 'NEWQATABLE' must be declared
5/7 PL/SQL: Item ignored
10/3 PL/SQL: SQL Statement ignored
10/17 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
12/3 PL/SQL: Statement ignored
12/24 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
LINE/COL ERROR
Thanks
PeterIf you are going to have a table name or a column name as a parameter, then you have to open the cursor dynamically. The following example uses Native Dynamic SQL (NDS) to open a ref cursor dynamically. I also eliminated the group by clause, since it is intended for use with aggregate functions and you weren't using an aggregate function. Also notice that there are some other differences in terms of defining variables and fetching and so forth.
SQL> CREATE TABLE test_table
2 AS
3 SELECT deptno AS muni,
4 dname AS prov
5 FROM dept
6 /
Table created.
SQL> CREATE OR REPLACE PROCEDURE Dup_Add
2 (newqatable IN VARCHAR2)
3 IS
4 TYPE cursor_type IS REF CURSOR;
5 c1 cursor_type;
6 c1muni NUMBER;
7 c1prov VARCHAR2 (20);
8 BEGIN
9 OPEN c1 FOR 'SELECT muni, prov FROM ' || newqatable;
10 LOOP
11 FETCH c1 INTO c1muni, c1prov;
12 EXIT WHEN c1%NOTFOUND;
13 DBMS_OUTPUT.PUT_LINE (c1muni || ' ' || c1prov);
14 END LOOP;
15 CLOSE c1;
16 END;
17 /
Procedure created.
SQL> SHOW ERRORS
No errors.
SQL> SET SERVEROUTPUT ON
SQL> EXECUTE dup_add ('test_table')
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS
PL/SQL procedure successfully completed. -
XI 3.0 File receive comm.channel using variable for folder/file name schema
Hi,
I prepared a integration message to produce .txt file output of message.
I prepared message successfully, it's running properly and producing .txt file.
My problem is to set .txt file name.
I must set file name using by some information in .txt file.
I must get some part of the first line of .txt to set filename.
I declared a variable to do it.
How can i set referance of variable?
payload:..?
Thanks.Hi,
this blogs might be helpful:
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID0935780750DB11281184595516315205End?blog=/pub/wlg/13704
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID0935780750DB11281184595516315205End?blog=/pub/wlg/2664
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID0935780750DB11281184595516315205End?blog=/pub/wlg/1888
http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
Regards
Patrick -
Substitution Variable for Field Name - Use in LOV Defintion
Hi,
I need to build an application with a lrage number of fields based on an LOV (Select List). All the LOVs will be sourced from a single table:
LOOKUP_TYPE VARCHAR2(30)
LOOKUP_CODE VARCHAR2(30)
MEANING VARCHAR2(100)
Each field will therefore need a simple LOV of:
select lookup_code, meaning
from
app_lookups
where
lookup_type = 'LOOKUP_TYPE_NAME'
order by 2Not complicated but it will take a long time due to the number of fields (across many pages).
I would like to be able to have the same code for all fields. Something like:
select lookup_code, meaning
from
app_lookups
where
lookup_type = V('THIS_FIELDS_NAME')
order by 2With this code I could simply copy fields around and rename them - the LOVs would automatiically select the right values by using the Field Name to find the correct codes.
A long shot - but worth asking.
Any thoughts?
Thanks,
MartinHi Andy,
Yes I know about Shared Component LOVs but this does not address my issue. I am also not restricting based on a page item value. I just want to restrict dynamically based on the field name.
On a page I will have at least 30 items, each with their own LOV. I can define an LOV for each item (either directly or though shared components) but each needs to be individually coded (where lookup_type = 'XXXX' with XXXX being different for every field).
If possible I would like to dynamically use the field name to select the group of lookup codes that I want - all fields could then have the same code (or potentially the same Shared Component LOV).
Not a major issue, but it would make my life a lot easier!!
Martin
Maybe you are looking for
-
How do I unlock 4S that has been upgraded to iOS 7. Entered passcode does not work
How do I unlock 4S I phone that has just been upgraded to iOS 7? The submitted code does not work.
-
Hi I have a document set with properties Type, name , modified and modified by . I want to include additional properties in document set content items .Is there a way to change the properties , or hide some properties from document set .How d
-
Hi, where can I find good easy material on net fro AWR and ADDM with examples and scenarios. Thanks rgds saaz
-
OS 10.4.5 Released - Any Problems?
OS 10.4.5 has been released. Any problems encountered? -Bmer Mac Owners Support Group Join Us @ MacOSG.com An Apple User Group MacOSG Podcast >>
-
My Crystal Reports Abruptly shuts-down Immediately after opening
When I launch Crystal Reports 2008, the program open and load normally but as soon as it's finished loading it closes immedaitrely. This issue just started yesterday, Dec 22nd, 2010. I haven't really been using the program yet. I am just finishing re