Populating array of values in GlobalContainer.

Dear Friends,
I have a doubt in excecuting the GlobalContainer in UDF. It will be great if you guys help me out in solving it.
I'm passing some array of values into UDF.After doing some validations I need to set these values in array of Global Container.Later in other UDF I've to retrieve the array of values from the Global Container.
Can you  guys shed some light on what logic needs to be done ?
Best regards,
raj.

Use Java Sections instead of GlobalContainer.
Check this link: http://help.sap.com/saphelp_nw2004s/helpdata/en/49/1ebc6111ea2f45a9946c702b685299/frameset.htm
on the java sections part.
Basically you define the global variable in the Global Variables section. For example:
List list = null;
Then in initalization section, you initialize the global variable:
list = new Vector();
Then you could have your UDFs filling and later reading the variable (just read/write the <i>list</i> variable).
In the Cleanup section, you can do for example:
list.clear();
Regards,
Henrique.

Similar Messages

  • In query ( * )asterisk sign is populating instead of values.

    Hi,
    In a Bex Query,i have currency & units in key figures(it is calculated Key Figure),output is populating as(*)instead of values for some records.Many records it is populating the correct value.I have tried Currency conversion also but all the currency are converting in to one currency...so output is not matching the task.
    How to solve this issue?

    If you are running your query on the Web, you can right-click on () and choose "Explain Key Figure" or something like this from pop-up menu. This should help you to find KFs causing your () value.
    Regards,
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/37289">vitaliy</a>

  • Rookie Question: Swap values? Declare an array and values of its indices?

    Hello,
    I hope this is the right forum: I have a simple Java Problem but i do not get it.
    Is like that: I have to swap values within an array e.g i have one array with 3 indices. Indice 0 (the first indice) has value 12. The middle indice has no value, and the second indice has value 9. How to swap 9 to 12 and 12 to 9 without direct swap, in other words, by using the middle indice that has no value or is zero? And how do i write it in an array?
    My other questions: How do i Declare an array and values of its indices?
    I hope this is the right forum or site at all, in cas enot, i hope you still can help or give me links that could help. I really need this.

    Hi Rookie,
         http://forum.sun.com is the best place to get answers for your queries.
         Answer to you first question:
         array[0]=array[0]+array[2]; // array[0] will have 21, because 9+12.
         array[2]=array[0]-array[2]; // array[2] will have 9, because 21-12.
         array[0]=array0]-array[2];  // array[0] will have 12, because 21-9.   
         Hope your first query is resolved.
         I will answer your next query in my next reply.
    Thanks & Regards,
    Charan.  

  • Passing array of values from front panel to menu

    I am working with a group programming a multichannel current stimulation device and we are currently having trouble setting up the run time menu. The burning question that we have is trying to figure out how to pass an array of values from the front panel to the menu that we are setting up in the block diagram, any advice?
    Thank you

    Take a look at this. Its just a simple menu update using a for loop. Uses whatever your values are as the item tag and item names. Remember, item tags need to be unique. This specifically goes under the sub menu of channel, which has to be created before.
    Attachments:
    menu.vi ‏12 KB

  • Best Way to Create Array of Values From ArrayCollection

    I often use Arrays of values from ArrayCollections in my
    application in order to facilitate faster performance when
    filtering other Collections.
    For instance, let's say I have an ArrayCollection of Objects
    with the properties "id", "name", "label", and "isActive". What
    would be the best way to get an Array of all the "id" values?
    Right now, I am looping over the ArrayCollection, and adding
    the value of the property I need to an Array using Array.push().
    For larger Collections, this seems like overkill. I was wondering
    if anyone knew of some quicker way to get an Array of values of one
    property from an Array Collection.
    My current method for doing this is attached below...
    Thanks.

    No, that won't work - toArray() simply returns the entire
    Collection as an Array.

  • Updating a JTable with an array of values

    Ther is a constructor that allows for the cretion of the table with an iniital array of values. However subsequent updates of blocks of data- say you received an array of updated data form a database- reuiqre you to update ince cell at a time. Is ther any way fo updating a whole block at once. I should point out that I am asking this because I am using JTables in the Matlab programming environment where arrays are the basic unit and looping through is a comparatively slow process

    Yes, you can extend the AbstractTableModel and write a method for updating a whole block.
    lets say you've got a Vector with Float[] arrays as elements to hold a 2D array of Float. The you could write:
          TableModel dataModel = new AbstractTableModel() {
                public int getColumnCount() { return col_names.size(); }
                public int getRowCount() { return data.size();}
                public Object getValueAt(int row, int col) {
                   return ((Float)((Float[])data.elementAt(row))[col]).toString();
                public String getColumnName(int col) {
                 return ((String)col_names.elementAt(col));
                public Class getColumnClass(int col) {
                 return String.class;
                public boolean isCellEditable(int row, int col) {
                  return true;
                public void setValueAt(Object aValue, int row, int col) {
                   try {
                     Float fv = Float.valueOf((String)aValue);
                    ((Float[])data.elementAt(row))[col] = fv;
                   } catch (Exception ex) {
                public void setBlock(Float block[][], int row, int col) {
                   // copy the Arrays with System.arrayCopy into data
          };PS: I don't know, if the above is correct written, havn't test this. But I hope you can recognize the idea behind it.
    wami

  • Show biggest index in array with value "True"

    Hello,
    Is it possible to show the maximum index number with value "true", like shown underneath?
    I can show the value on what index the series of "true" ends with the "Array Max & Min" function, but when there is
    one False between those True's, it will show the index of the True left of the False.
    I don't need to know the size of the array, because it has to stay 8
    File is attached
    Solved!
    Go to Solution.
    Attachments:
    Biggest index of array with value 1.vi ‏8 KB

    Hi Stef,
    here you go:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Need help with persistance using an array of values

    I have an array of values, say:
    String[] fruit = {apples, oranges, pears}
    And I want to know how to send this into a database table that is separate from the rest of the class. for example, the fruit array is part of a class Food. Food has the following fields:
    @Column(Name= food_type)
    private String foodType;
    String[] fruit
    Say that the Food class places the foodType variable in the Food table, but I want to place each item of the fruit array into a separate table that has the fruit type, and Food_id that links it back to the food table.
    What is the correct code for this?

    jobocop17 wrote:
    I have an array of values, say:
    String[] fruit = {apples, oranges, pears}that won't compile without quotes around the strings
    And I want to know how to send this into a database table that is separate from the rest of the class. there are a number of ways to do this
    i recommend you start with JDBC
    for example, the fruit array is part of a class Food. Food has the following fields:
    @Column(Name= food_type)
    private String foodType;
    String[] fruit
    Say that the Food class places the foodType variable in the Food table, but I want to place each item of the fruit array into a separate table that has the fruit type, and Food_id that links it back to the food table.
    What is the correct code for this?When you write the code and it does what you want, you will then know the answer to this question.

  • I controled voltage output by vertical pointer slide In my vi.Now,I try tocontrol it by a series accurate values. I want to get output according to the array's value.

    I controled voltage output by vertical pointer slide In my vi.Now,I try to
    control it by a series accurate values. I want to get output according to
    the array's value.
    Attachments:
    input+output.vi ‏51 KB

    Yun,
    Here's a simple example I wrote that does what you are trying to do. You can wire an array into an Analog Out 1D DBL 1 chan N Samples. Then I wired the size of the array into the number of samples per channel on the timing vi.
    Regards,
    Danny F
    Danny Funk -- Staff Product Support Engineer -- InsightCM R&D -- National Instruments
    Attachments:
    AnalogOut Array.vi ‏20 KB

  • How to write array of values to cluster of indicators(tank sliders)??

    I am trying to write a 1-D array of values to thier corresponding 8 tank sliders.
    So each element of the array will be displayed as the value of the slider.
    How can I do this?
    It works if you display it to a cluster of numeric values, but not the sliders.
    I also tried writing the array to the "value" property  of the each of the sliders, but still doesn't seem to work.
    Any suggestions?
    Solved!
    Go to Solution.

    001,
    How did you create those sliders? They are actaully clusters of two elements, both of which appear to be identical sliders sitting on top of each other.
    That is probably why you are having so much trouble wiring your data to them.  I suggest that you create a new cluster with standard sliders.  Then you can use the Array to Cluster primitive to move the data.
    Two cautions: 1. The Array to Cluster defaults to 9 elements in the cluster regardless of the number of elements in the array.  Pop up on the cluster output terminal to change the number of elements if needed.
    2. You apparently added items to the cluster out of order.  The cluster order is important if you want to get the data to the right places.
    Also, it would be much easier for us to test your code if you included some data in 2D Array Input.  Put the data in there then Edit >> Make Current Values Default. Then save.
    Lynn

  • Is it possible to pass an array by value?

    I am trying to create a list of String arrays holding all the different possible combinations for a little problem I was working on. the function Solve takes a String array argument that is passed by reference and so when I add a value to it all of the previous String array values for str get that value when I want each of them to have their own values. Can I pass the string array by value? or do I just need to change my code....and if it is the latter, any tips on structuring my code?
    Thanks
    import java.util.ArrayList;
    public class Solution
         Solution()
         public ArrayList<String[]> solve = new ArrayList<String[]>();
         public String[] Direction = {"LEFT","RIGHT","TOP","BOTTOM","C_LEFT","C_RIGHT","C_TOP","C_BOTTOM","FSLASH","BSLASH"};
         public boolean isNextTo(String a, String b)
              return true;
         public boolean notUsed(String[] s, String a)
              for(int i=0;i<s.length;i++)
                   if(s[i] == a)
                        return false;
              return true;
         public String[] Solve(String[] str, int element)
              //solve.add(str);
              int index = solve.size()-1;
              for(int dir=0;dir<10;dir++)
                   System.out.println("\nchecking " + Direction[dir] + " for element " + element);
                   printList();
                   //if(isNextTo(str[element], Direction[dir]));
                        if(notUsed(str, Direction[dir]))
                             System.out.println("\nadding " + Direction[dir] + " to the list ");
                             str[element+1] = Direction[dir];
                             solve.add(Solve(str,element+1));
              return str;          
         public void printList()
              for(int i=0;i<solve.size();i++)
                   System.out.println("\nSolution " + i + ":");
                   for(int j=0;j<10;j++)
                        System.out.print(solve.get(i)[j] + ", ");
         public static void main(String args[])
              Solution s = new Solution();
              String[] a = new String[10];
              a[0] = "LEFT";
              s.solve.add(a);
              s.Solve(a, 0);
              s.printList();
    }Edited by: newms86 on May 19, 2008 2:10 AM

    I tried adding in a clone array like this:
    public String[] Solve(String[] str, int element)
              //solve.add(str);
              String[] a = str;
              for(int dir=0;dir<10;dir++)
                   System.out.println("\nchecking " + Direction[dir] + " for element " + element);
                   printList();
                   if(isNextTo(str[element], Direction[dir]));
                        if(notUsed(str, Direction[dir]))
                             System.out.println("\nadding " + Direction[dir] + " to the list ");
                             a[element+1] = Direction[dir];
                             solve.add(Solve(a,element+1));
              return str;          
         }but all the elements in the ArrayList are the same. What do I need to change?
    Edited by: newms86 on May 19, 2008 2:23 AM

  • New to Java: Populating Arrays and searching

    I am really stuck. I need to know how to search for an array that is already populated. The user will type in a string, and the string must match with one of the populated array. What is the best way to go?

    You mean you want to know if a String matches an element in an array? If so, turn the array into a List and use contains();
    import java.util.*;
    String [] stringArray = // already populated
    List stringList = Arrays.asList(stringArray);
    now test:
    String s = // input from user
    if (stringList.contains(s)) {
    // found a match

  • Populating application constant values using context namespaces

    I have a table like below:
    SQL> SELECT * FROM my_constants;
    CONSTANT_ID CONSTANT_O CONSTANT_N CONSTANT_V CONSTANT_T CONSTANT_MODULE       SOURCE_ID
          10252 CONSTANT1  CONSTANT1  5000       NUMBER(10) MODULE1                       1
          10253 CONSTANT2  CONSTANT2  5001       NUMBER(10) MODULE2                       1
          10254 CONSTANT1  CONSTANT1  6000       NUMBER(10) MODULE1                       2
          10255 CONSTANT2  CONSTANT2  6001       NUMBER(10) MODULE2                       2I have created a context which uses a procedure load_constants in a package global_constants, say . Right now this package is loading all the rows of CONSTANT_NAME and CONSTANT_VALUE using a logon trigger. I also have a get_val procedure in the package which returns the value of a constant when I query like following:
    select global_constants.get_val('CONSTANT1') from dual;All is working fine till here. But, if you observe, the constant names are common in my table, but they are seggregated by SOURCE_ID. Now, my question is that, is there a way I can have the constant names common, but can retrieve the values based on the SOURCE_ID and CONSTANT_NAME combination?
    Since DBMS_SESSION.SET_CONTEXT accepts only three parameters (i.e, It only allows us to populate a max 2D array values), I am unable to set the combination. I already can think of a way of handling it a crude way by appending the combination and loading it. But, in the current situation, it is not possible to do so. Also, please note that the logon trigger does neither know which source has created this session nor which source values it should populate, so is populating everything.
    Any Ideas?

    SQL> select * from my_constants;
    CONSTANT_ID CONSTANT_O CONSTANT_N CONSTANT_V CONSTANT_T CONSTANT_MODULE       SOURCE_ID
          10252 CONSTANT1  CONSTANT1  5000       NUMBER(10) MODULE1                       1
          10253 CONSTANT2  CONSTANT2  5001       NUMBER(10) MODULE2                       1
          10254 CONSTANT1  CONSTANT1  6000       NUMBER(10) MODULE1                       2
          10255 CONSTANT2  CONSTANT2  6001       NUMBER(10) MODULE2                       2
    SQL> CREATE OR REPLACE PACKAGE my_constant_info
      2  IS
      3     PROCEDURE load_context;
      4 
      5     FUNCTION get_val (in_constant_name IN VARCHAR2)
      6        RETURN VARCHAR2;
      7  END my_constant_info;
      8  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY my_constant_info
      2  IS
      3     PROCEDURE load_context
      4     IS
      5        l_names    DBMS_SQL.varchar2s;
      6        l_values   DBMS_SQL.varchar2s;
      7 
      8        CURSOR con_cur
      9        IS
    10           SELECT   constant_name, constant_value
    11               FROM my_constants
    12           ORDER BY constant_id DESC;
    13 
    14        l_count    NUMBER (8);
    15        l_name     VARCHAR2 (100);
    16        l_val      VARCHAR2 (400);
    17     BEGIN
    18        FOR i IN con_cur
    19        LOOP
    20           l_count               := con_cur%ROWCOUNT;
    21           l_names (l_count)     := i.constant_name;
    22           l_values (l_count)    := i.constant_value;
    23           DBMS_SESSION.set_context ('my_context', l_names (l_count),
    24                                     l_values (l_count));
    25        END LOOP;
    26     EXCEPTION
    27        WHEN OTHERS
    28        THEN
    29           DBMS_OUTPUT.put_line (l_count || ', ' || l_name || ': ' || l_val);
    30           RAISE;
    31     END load_context;
    32 
    33   FUNCTION get_val (in_constant_name IN VARCHAR2)
    34        RETURN VARCHAR2
    35     AS
    36        l_return_val   VARCHAR2 (400);
    37        l_null_val     EXCEPTION;
    38     BEGIN
    39        l_return_val    := SYS_CONTEXT ('my_context', in_constant_name);
    40 
    41         IF l_return_val IS NULL
    42        THEN
    43           RAISE l_null_val;
    44        ELSE
    45           RETURN l_return_val;
    46        END IF;
    47     EXCEPTION
    48        WHEN l_null_val
    49        THEN
    50           raise_application_error (-20011,
    51                                       'Requested Constant '''
    52                                    || in_constant_name
    53                                    || ''' Returned Null.');
    54     END get_val;
    55  END my_constant_info;
    56  /
    Package body created.
    SQL> CREATE CONTEXT my_context USING my_constant_info;
    Context created.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER my_constant_logon
      2     AFTER LOGON ON DATABASE
      3  BEGIN
      4     my_constant_info.load_context;
      5  EXCEPTION
      6     WHEN OTHERS
      7     THEN
      8        RAISE;
      9  END;
    10  /
    Trigger created.
    SQL> BEGIN
      2     my_constant_info.load_context;
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select my_constant_info.get_val('CONSTANT1') from dual;
    MY_CONSTANT_INFO.GET_VAL('CONSTANT1')
    5000
    SQL> I am able to get the value 5000. But, if you look at the data back, there are two rows with CONSTANT1 one for source_id 1 and another for 2. The values of the CONSTANT1 changes according to the source_id. I would like to implement such a solution that it will have to output the values based on the combination of CONSTANT_NAME and SOURCE_ID
    One way (not practical for me) is as follows:
    SQL> CREATE OR REPLACE PACKAGE BODY my_constant_info
      2  IS
      3     PROCEDURE load_context
      4     IS
      5        l_names    DBMS_SQL.varchar2s;
      6        l_values   DBMS_SQL.varchar2s;
      7 
      8        CURSOR con_cur
      9        IS
    10           SELECT   constant_name ||'-'|| source_id constant_name, constant_value
    11               FROM my_constants
    12           ORDER BY constant_id DESC;
    13 
    14        l_count    NUMBER (8);
    15        l_name     VARCHAR2 (100);
    16        l_val      VARCHAR2 (400);
    17     BEGIN
    18        FOR i IN con_cur
    19        LOOP
    20           l_count               := con_cur%ROWCOUNT;
    21           l_names (l_count)     := i.constant_name;
    22           l_values (l_count)    := i.constant_value;
    23           DBMS_SESSION.set_context ('my_context', l_names (l_count),
    24                                     l_values (l_count));
    25        END LOOP;
    26     EXCEPTION
    27        WHEN OTHERS
    28        THEN
    29           DBMS_OUTPUT.put_line (l_count || ', ' || l_name || ': ' || l_val);
    30           RAISE;
    31     END load_context;
    32 
    33   FUNCTION get_val (in_constant_name IN VARCHAR2)
    34        RETURN VARCHAR2
    35     AS
    36        l_return_val   VARCHAR2 (400);
    37        l_null_val     EXCEPTION;
    38     BEGIN
    39        l_return_val    := SYS_CONTEXT ('my_context', in_constant_name);
    40 
    41         IF l_return_val IS NULL
    42        THEN
    43           RAISE l_null_val;
    44        ELSE
    45           RETURN l_return_val;
    46        END IF;
    47     EXCEPTION
    48        WHEN l_null_val
    49        THEN
    50           raise_application_error (-20011,
    51                                       'Requested Constant '''
    52                                    || in_constant_name
    53                                    || ''' Returned Null.');
    54     END get_val;
    55  END my_constant_info;
    56  /
    Package body created.
    SQL> BEGIN
      2     my_constant_info.load_context;
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> select my_constant_info.get_val('CONSTANT1-1') from dual;
    MY_CONSTANT_INFO.GET_VAL('CONSTANT1-1')
    5000
    SQL> select my_constant_info.get_val('CONSTANT1-2') from dual;
    MY_CONSTANT_INFO.GET_VAL('CONSTANT1-2')
    6000
    SQL> I would like to know any other elegant way of implementing the same, where in if I say something like
    select my_constant_info.get_val('CONSTANT1', p_source_id) from dual;
    or
    v_cons_val := my_constant_info.get_val('CONSTANT1', p_source_id);
    ** where p_source_id is a value passed to a procedure and v_cons_val is a variable, say.Please let me know if you need any further infomation.

  • Populating Array

    Hi,
    I'm having trouble populating a 1D array using a Replace Array Subset function. The two arrays coming from the top are two separate ones. 
    This program is supposed to compare two adjacent elements in one array and flows through a case structure. If true then it outputs an index integer if not then right now it outputs the default (don't know how to make it output nothing or skip). But using the output index, it indexes from another array to receive another corresponding element. I want to populate a new array with these elements which pass the decision process on the left. I think I'm supposed to use Replace Array Subset function but I don't know how to set the index for that function so it increments after each new element is put in. 
    I initialized an array with 1000 spots but since I did that I couldn't really use append array.  
    If there is another function I'm supposed to use or perhaps a totally easier approach to do this then ideas are welcome. I'm also trying to populate a text file with these elements but I don't know if that's going to work out either. 
    Thanks!
    Attachments:
    06-27-12-block-half-array.PNG ‏31 KB

    Ghoster wrote:
    I don't really know why checking for inequality is unnecessary for dbl.
    There are many discussions about hwo equality checks are invalid for floating point numbers due to rounding somewhere in the binary code.  Every computer language has this issue.
    Ghoster wrote:
    But no, that's not what I want. I want it to step each index of the new array and populate it with values based on the logic in the case structure. (not just the 0th element).  
    How large is your initial array?  If it is less than 1000 elements, then your results make perfect sense.
    Anyways, here's an example of what I was saying with the shift registers.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Update with Replace Array Subset.png ‏25 KB

  • Pass array of value to Oracle Java Beans (for forms)

    Hi,
    How I can pass a array value from oracle Form to Java bean.
    With regards
    Satheesh Kumar

    Hi,
    Thanks for your immediate response.
    I have one more doubt. I am trying to create a Hirachical tree for form using Jtree. For dynmically populating tree data I want to pass array records from oracle forms.
    In my understanding, Java importer array will work if we do importing the java beans component to oracle forms, otherwise no.
    Is it possible I can pass array variable with out importing my javacomponent.
    With regards

Maybe you are looking for