Dynamically create (global) variables

Hi,
Is it in anyway possible to dynamically create variables, like you can do in Forms:
DEFAULT_VALUE('test', v_test);
with v_test holding the variable, like 'GLOBAL.TEST'. Forms would then create me the variable as it doesn't exist yet, assigning the given value.
Like this I could read my variables' names from a DB table, dynamically create them, and assign their values. Inside the report I would then use them as lexical references.
I know I can create parameters inside the report achieving the same, but we need the table-approach for our translations. Getting rid of the parameters' overhead would be great!
Any suggestions appreciated,
K.

Where the lov is attached set the VALIDATE FROM LIST property to YES and craate one trigger for each field called WHEN-VALIDATE-ITEM and use the code as below...
IF GET_ITEM_PROPERTY('FORM_FIELD_NAME',ITEM_IS_VALID)='FALSE' THEN
  :FORM_FIELD_NAME:=:GLOBAL.EmpCode;
END IF;
Don't forget to set NULL for global variable in KEY-LISTVAL trigger after assigning value to the form's field.
HTH.
-Ammad
Edited by: Ammad Ahmed on Nov 8, 2010 4:33 PM

Similar Messages

  • Is it possible to dynamically create psp variables?

    I'd like to be able to dynamically create psp variables on the fly.  Without getting into details; using straight shared variables defined in a library is too constraining for my application.  I've found that I can create PSP variables dynamically using DataSocket VIs in the System directory (psp://localhost/system/), though I can't seem to do it with the LV Shared Variable VIs.  I was just curious if there was any way to programmatically create psp variables without using DataSocket VIs.

    In the client yes,
    Dynamically Creating Shared Variables
    The SVE will automatically create the target variable with default properties when a client attempts to connect to a URL with the following format.
    psp://computer/System/shared_variable, where shared_variable is the named tag for the data."
    On the server you create them. I believe, if my memory is correct, if you have DSC option there is code to dynamically create them on server side.

  • Creating global variables

    Hi,
    I am searching for the best way to create global variables so that the script can work on all adobe reader versions . I tried gobal.varibaleName at the initialize event of the form, but it is only working in the earlier versions of designer. I tried using script variables, but it always initializes the variable to string value. I have wrote some functions on the script object, and every time any functions fails, a  global variable count gets incremented. At the potsave event of the form if the count value is greater then 0 , a simple warning message is displayed . Now how to declare and initialize and increment this count variable so that the script can work on all the versions of adobe reader ?

    You need to change your code little bit..
    First,
    All Global Variables are String Type. If you use a "+" sign to add a number it will treat the value as string and append at the end.
    So if you want to do numerical calculations on the global variables first you need to convert them to the right type.
    In the below code I am parsing the value to an Integer type first before I increment it.
    Second,
    You have created a variable of name "count" which could be a reserved name. Try to avoid the reserved names for variables. So I created a variable "intCount".
    Third,
    After incrementing  value if you want to assign the value back to a Global variable you need to conver it to String type. (the opposite way like you did earlier in step 1 by converting String type to Integer)
    var a = parseInt(intCount.value) + 1 ; //Step 1
    intCount.value = a.toString();   //Step 2
    var b = parseInt(intCount.value) + 1;  //Step 3
    intCount.value = b.toString();  //Step 4
    Thanks
    Srini

  • How do you reference a created global variable in a report text field?

    I have created a parameter using the Globaldim statement in a script file. when I reference this parameter in any other script file during the current DIAdem session the value is passed without any issue.  Call the variable parmxyz where I assign it a value of 25.3 
    The help section under Globaldim mentions that global variables can be referenced in all panels, scripts, and dialogue boxes.  When I try to insert a text box on a report page using the @@parmxyz@@ it returns NOVALUE where I expect to see 25.3 (for example).
    When I substitute @@CurrDate@@ I do get the date, so I know the text box is valid.  What am I doing wrong?
    Steve    M 

    Hello Steve!
    It should work the way you did it. But their are some circumstances wich might prevent it:
    You have reseted the global script engine. All variables will be lost.
    You have a Sub with the same name in a command extension script. There is no warning ;-)
    One Test you can make is to put in '@@TypeName(paramxy)@@' as the expression to see the variable type. You can also try a realy unique variable name. The last option is to use ItemInfoGet to get detailed infos about your variable.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • Create Global Variable

    Hello developers,
    I need to create a global bind variable, which i can fill with a return value of a select statement. Can someone tell me how to do it, or send me a link, where global bind variables in APEX are explained

    Hi,
    Thanks for your information.
    >
    This works, when the condition of P0_END_TIME is "always", but doesn't work, hen it's "never".
    >
    Of course the conditional display for the other item will not work, if the conditional display for the P0_END_TIME is set as Never.
    Do you want to hide the item P0_END_TIME on the page where the other item is displayed?
    If yes set the conditional display as:
    Condition Type: Current Page is NOT in Expression 1 OR Current Page is in Expression 1(Use the appropriate one! )
    Expression 1: Comma delimited list of Page Numbers
    OR
    Do you want to hide the item P0_END_TIME for all the pages of the application?
    Then set the item attributes for P0_END_TIME:
    Display as: Hidden
    Value Protected: No
    Hope it helps!
    Regards,
    Kiran

  • Dynamically creating variable names in javascript

    Hi.
    I have to create variable names dynamically in JavaScript.
    My JSP file accesses information from Database and forms a String corresponding to the information received.
    This String is passed to a JAvaScript function that should CREATE a variable with that NAME.
    For Ex:
    My database access resulted in a single row...
    id name sal
    34 John Smith 38000
    the resulting VARIABLE NAME should be Menu34. 34 comes from the database result.
    Is there any function to dynamically create a variable name in JavaScript?
    Thanks in advance.

    The JSP is printing the contents of an HTML page, and Javascript code can be part of that output...
    So you would just write out the stuff, something like this....
    <script>
    <% while(rs.hasNext()) { %>
    var Menu<%= rs.getInt("id") %> = '<%= rs.getString("name") %>';
    <% } %>
    </script>
    In the browser, it'll just look like another long list of Javascript variables.

  • Is it possible to dynamically create a user variable at runtime from within a Widget?

    I'm trying to develop a custom Interactive Widget. This widget will allow the user to take multiple attempts, and needs to store information about previously completed attempts so they can (hopefully) see their improvements over time.
    I'm trying to figure out the best way to store the data about the previously completed attempts across multiple sessions in a LMS. It seems that the data stored in user variables is automatically stored/restored in suspend_data, which would be perfect. The issue is that I can't find a way to dynamically create a new user variable from within a Widget. It looks like I can only access user variables that the author has explicitly defined in the Captivate interface. I'd rather not have to force the author to define an empty User Variable that they'll never knowingly use, just to give the Widget a bucket to store its data.
    Does anyone have any ideas for what might be the best way to accomplish this? I'd like to stick to standard, "approved" APIs as much as possible, but I'd be willing to bend some rules if necessary.
    Thanks!

    Ryan,
    I assume you've asked this question here:
    https://groups.google.com/forum/?fromgroups#!topic/elearning-technology-and-development/e5 vWZfJ6X8I
    I asked a similar question here:
    https://groups.google.com/forum/?fromgroups#!searchin/elearning-technology-and-development /leichliter/elearning-technology-and-development/Au88bu7LB5o/TC7xlo8iBpQJ
    Philip gave you sound advice.  You'll have to hijack/re-purpose the comments or the suspend data.  I was successful in using SCORM comments in a Moodle system to store extra data I needed for a customer.  It's not ideal, but it gets the job done. Here's a thread about that:
    https://groups.google.com/forum/?fromgroups#!topic/elearning-technology-and-development/Yg YAMGfXQNw
    If you use suspend data, you have to watch out for a few things:
    1.  It's base 64 encoded... so any data you append to what Captivate outputs will need to be in base 64 (that's a good practice anyway since the data has to be serialized).
    2.  On course re-entry, you'll need to capture the suspend data before it hits Cp to strip off / read your needed data.  If the suspend data isn't in the format Cp expects, you'll get a nice white screen of death.
    Ideally, it would be nice to be able to dynamically create user variables for purposes like this... and it's been requested in Cp 6.... we'll see if it gets added (not holding my breath).  Until then, I'd use cmi.comments.
    Jim Leichliter

  • 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

  • Global Variable in Package Specification

    Hello,
    I created global variable in package specification,
    Is it valid for the current session or it will work for all the session.
    Thanks,Kannan.K

    Package varaibles are session bound, to demonstrate, a simple test:
    --session 1:
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
    SQL> exec dt_test_pack.set_global(50);
    PL/SQL procedure successfully completed.
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
            50
    --Session 2 at the same time
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
    SQL> exec dt_test_pack.set_global(100);
    PL/SQL procedure successfully completed.
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
           100
    --Back to session 1:
    SQL> exec dt_test_pack.set_global(null);
    PL/SQL procedure successfully completed.
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
    --Back to session 2:
    SQL> select dt_test_pack.get_global from dual;
    GET_GLOBAL
           100HTH
    David

  • Global Variable declaration in Custom Infotype

    Hi All,
    I need to validate a custom infotype field, where i need to check for execution times. I need to override the field value only during first time of the run(PAI logic) and there after user can choose a value of his choice.
    I was looking out for Global variable to check if its first run. Can you please tell me how do i create global variable in custom infotype? The top include specified in the program is not editable, being standard (MPH5ATOP).
    Thanks,

    >
    Sachidanand B wrote:
    > Hi All,
    >
    > I need to validate a custom infotype field, where i need to check for execution times. I need to override the field value only during first time of the run(PAI logic) and there after user can choose a value of his choice.
    > I was looking out for Global variable to check if its first run. Can you please tell me how do i create global variable in custom infotype? The top include specified in the program is not editable, being standard (MPH5ATOP).
    >
    > Thanks,
    The system will generate an include with the naming convention ZP<Custom Infotype number>10(This program will be included in the custom infotype main program ZP<Customeinfty number>00). You can use this include for your data declarations.
    Ex: if the number of the custom infotype is 9010 the generated include name will be ZP901010.
    For more details check the link below
    http://help.sap.com/saphelp_47x200/helpdata/en/4f/d525ad575e11d189270000e8322f96/content.htm
    Regards
    Rajesh:

  • Global Variables in BI

    Hi,
    Can anyone explain me the steps to create global variables in BI with out using Query designer?
    I do not have the infoobject in my cube but still I need a variable i.e for currency translation with out the need of adding the infoobject to the cube.
    Thanks
    Sri

    Hi Sri,
    You can create a bew variable in table RSZGLOBV. Also all variables used in BW Queries are global, i.e. not tied to any InfoProvider. You can use a variable created for a query on Cube A, in a query on cube B. The variables are attached to the InfoObjects (Char variables). There are other variables like formula variables which may not be attached to an InfoObject.
    Hope this helps...

  • Declare global variable and retrive?

    Hi,
    we are working in live project in webtool, we wants to create global variable,
    calling that variable in a required pages, our questions is that where to declare global variable and how to declare in which page we have to declare?   pls guide us its very urgent and send the code.
    Regards
    Kannan.D
    Edited by: kannan desikan on Jan 14, 2008 8:07 AM

    Hi Kannan,
    I would suggest using a comma delimied list or putting it in the database.
    ArrayList myList = new ArrayList();
    myList.Add("one");
    myList.Add("two");
    myList.Add("three");
    string comma = "";
    // store the array in the session state
    foreach (string s in myList){
      Session["persistedArray"] += comma + s;
      comma = ",";
    To get the array back
    if (Session["persistedArray"] != null){
      ArrayList myList = Session["persistedArray"].ToString().Split(new char[1] {','});
    If your array is storing objects, you should use the database.

  • Global variable readonly

    I chose to try/use a global variable to resolve a complex situation I was having.  I followed the "Creating Global Variables" from LabVIEW help and everything seemed to work fine.  The global stopped working, however, when I checked my files into CM and the xxxGlobal.vi (created by the global variable process) was readonly.  I didn't see a runtime error, but the global always returned the default.  Then, when I changed the file's attributes (enchecked readonly), I could exercise the other functionality.
    Is this a known issue - do I have to make this global.vi read/write for all users, or is there another solution?

    I don't think my conclusion (above) is correct.  I had a case statement error that made it appear that the readonly was the issue, when it was not.  I'm not sure what the deal is now.  Here is what I did.
    I placed a global variable(gv) in the block diagram of one VI, then double clicked on the gv and got a blank vi.  I dropped a text control onto the front panel and named it ReportFormat.  I then did a "save as" to save the new (global) VI.  I then added some logic (where I originally dropped the gv) to populate the global variable with the user's selection from a drop down (two possible choices) .  I then went to another VI and in its block diagram I did a "Select VI", found/selected this global.vi I just created.  Since I only have one item on the front panel (in the global.vi), I received an association to ReportFormat.  I did a  "Change to Read" so I can use the string output to drive a case statement.  The default case is always selected, though.

  • Programmatically select global variable object

    Hello all.
    I have a rookie question that may have an easy answer (or perhaps you can direct me to a different method which is fine too).  I’m using a global variable in an instance where it’s controlled by a parent VI and read by multiple children VIs.  The global variable contains Boolean switches, each with a specific name.  
    If possible, I’d like to make the ‘child VI’ more generic and programmatically flexible so that I don’t have unique children.  That way, instead of four children, I just have one (makes debugging easier).  Here’s the crux of my question:  selecting which object is assigned to the global variable on the block diagram is done by clicking on it with the mouse – can I instead do that programmatically?
    More specifically, when using the global in children VIs (as instructed in the “Creating Global Variables” section of the help files), you can select the global vi and add it to your block diagram.  The next step is to select the front panel object to associate the placed variable with the proper data (you do this by mouse clicking the node you just created – see the attached image).  My question is, can I select the object associated with the placed node programmatically instead of needing to mouse click on it?
    Cheers!
    Attachments:
    ForumEX files.zip ‏31 KB

    Steve Chandler wrote:
    There is a better way of doing this as the others have already pointed out.
    Even Single Process Shared Variables with their API Interface would be better as Globals:
    Using this VI to read the variables gives you the ability to reference them with a string (Link to Variable). You may have to add an additional variable in future versions of your code, where you just need to add the new variable to the project and pass the string to the VI without changing the code. Single Process Shared Variables are based on Global Variables, which are usually just a bit faster. Single Process Variables can easily be converted to network variables.
    However, I agree with Damien that Data Value References would probably be the best sulution.
    Btw, there is a good KB talking about Globals: Are LabVIEW Global Variables good or bad, and when is it ok to use them?
    Christian

  • Dynamic call of a vi with a reference stored in a global variable

    Hello,
    I am trying to program a VI which calls DAQmx functions in some cases, in other cases DAQmx may not even be installed. To prevent a broken arrow on machines where DAQmx is not installed, I want to use a sub-VI containing the DAQmx function calls which is called dynamically by a main VI. For speed I want to prevent continuous opening and closing the VI reference, so I want to store the reference to the sub VI in a global variable. In this variable I also want to store the Analog Input Task. I want to use an initialization VI to write the VI reference of the sub VI and to configure and start the Analog Input Task and write the Task ID to that Global, too. In that way I was hoping to be able to improve the performance of the dynamic calls and the Task calls. BUT - when I write the refererence and task to the Global and read it out from another VI, the reference is not valid anymore and the Analog Input task is also not valid, even if both the initialization VI and the Global are still open (but not running). Does somebody have an idea how to solve that? It is a bit difficult to describe, so here is what I want to do in a shorter description :
    - run a initialization VI which
      defines a reference to a sub VI which will be called dynamically later on
      and a AI task ID definining a DAQmx physical channel configuration to use for subsequent read cycles
      and writes both (VI reference and AI task) to a global variable
    - run another VI which
      reads the VI reference of the VI to call dynamically from that global
      runs the corresponding VI dynamically
      the dynamically called VI performs an AI task corresponding to the DAQmx task ID read from that global (it reads an analog value for instance from the  
      physical channel configured by that AI task) 
    Why all that? To prevent creating and destroying the VI reference for each call of the sub VI for speed. And to use the configured DAQmx channel for subsequent read tasks only if the subVI is called dynamically - if it is not, then the application will not see the DAQmx calls and therefore no broken arrow will occur if no DAQmx is installed on the machine.
    Can somebody help me with this? Why can't I store and read out the reference to the sub VI to/from a global, and why is the AI task not valid when read out from the dynamically called sub VI? I am somewhat lost with all that...
    Thanks in advance,
    Gabs

    Uh - I am almost getting crazy with that
    Kevin, that solution is the right one for programming an application. In that case everything will work fine. But during testing, it is more convenient to call all VIs from their front panels one after another. That's how I'm doing it for everything that needs to be exchanged between such VIs: store them either in a global or in a functional global variable. In that way the user can "play around" with the VIs without wiring them together in a main VI. Therefore, after some thinking I liked Davids idea with that daemon VI (I solved that by adding a boolean in the initialization VI to choose if that daemon is necessary - during testing phase - or not - when using the VIs in a main application). BUT:
    David: It does not work!!! I have exactly done what you proposed and this daemon VI is really running, having a True/False frame with a constant of False wired to the selector and holding both the functional global and the dynamically to call VI in the True frame. In that way, after initialization is finished, both VIs are still running but idle. Anyway, when I read back the value of the reference or the DAQmx task, it is invalid again!
    That really costs just too much time. Does anybody have any idea what to do now? David, I was hoping that your suggestion would solve the problem, because it would be logical that it would - why then is LabVIEW destroying the reference and task anyway even if that daemon VI containing the functional global is still running???
    Regards,
    Gabs

Maybe you are looking for