How to read the table of SQL: ActiveRecord

We try to write a script here to interrogate a database that maintains an inventory of our servers and automatically increment the server name to the next available number in the string.  We are able to query the database, but the output seems to be encrypted as it is not readable.  I think I need to convert it somehow to make it useful.  Someone knows how can I do this?  I'm kinda new to javascript, so it's all new to me.

Here's the script we have got so far.

var preservername = resultVMName;

function zeroPad (num, count)

{

var numZeropad = num + ";

while(numZeropad.Length < Count) {}

numZeropad = '0' + numZeropad;

}

Return numZeropad;

}

var query = "SELECT MAX (ServerName) FROM servers WHERE servername as ' % ' + preservername + ' % ' limit 1';"

System.log ("Executing query" + query + "on the database" + database.name);

resultRecordsOut = database.readCustomQuery (query);

System.log(resultRecordsOut[0]);

var maxserver = resultRecordsOut [0] m:System.NET.SocketAddress.ToString ();

System.log ("It's the value of maxserver" + maxserver);

var prenumber = maxserver.substring (0.10);

var number = parseInt (maxserver.substring (10,13));

var newnumbers = zeroPad (numbers + 1, 2);

var newname = prenumber + newnumbers;

System.log (NewName);

OK... so I think that the last piece of the puzzle, here it is!  The value of each column is stored as a property inside the table, therefore, I think that you need to do is something like this:

resultRecordsOut = database.readCustomQuery (query);

resultLastRecord = resultRecordsOut [resultRecordsOut.length - 1];

System.log (resultLastRecord.getProperty ("MAX (ServerName)");)


This can get you where you need to be, more or less.

Tags: VMware

Similar Questions

  • How to read the table of string returned by the DLL

    I developed DLLS in labview that takes 2 input parameters as a string and returns an array of strings in return. How can I read back this array returned strings in labview? I tried to return a string and I can't able to read. But how to read a table?

    Is the signature of the function – void GetLoginInfo (char [] DBPath, char [UserName], LStrHandleArray * table)

    Shrinivas

    I found the solution. When you configure the node to call a library function, the argument (in which we expect an array of string) type should be chosen as "Adapt to the Type" and data format to be "pointers to the sleeves.

  • How to read the BIT of SQL Server value in CVI

    Hello

    I try to get a value of SQL Server 2005 (ture or false) bit in CVI (with SQL toolkit). I use the DBBindInt, but overall the return value is - 1.

    How can I get the real value of SQL?

    Thanks for your help

    Region

    Do you mean that you never receive the value FALSE, IE 0? Or you expect a TRUE value to be exactly 1? It is very common for TRUE to be represented as -1; If you are concerned just hide all the bits in the value returned with the exception of bit 0 - this will then give your alternative 0/1.

    JR

  • How to read the color table in a subvi?

    How to read the color table in a subvi? Is it made by a reference to the table or with a global variable? For a better understanding of the problem, I added to vi. Run the "run.vi." I want to see

    the background color of the table "run.vi" in the subvi called "read color.vi".

    How can I do?

    Thanks in advance

    Norick

    pop up on the wire table refernece and establishes 'control '. Add this control to the icon of the sub - VI decision-making and then wire ref of the appellant to this Terminal VI so the calling VI move the ref to the Subvi.

    Ben

  • How to remove the Tables of HFM Application in SQL

    Hi gurus

    1. how to remove the HFM Application Tables in SQL?
    Its manual removal but each application having 120-150 tables? How to do this in one fell swoop?

    I deleted some applications using the workspace / shared services, but still its display under HFM under the Tables of SQL Server.

    Please help me

    concerning
    Smilee

    Hi Smilee,

    1. If the application opens in the web management interface, go to Taskflows management module and make sure that no taskflows exist yet for this application. Remove any existing taskflows.

    2. If demand exists in Shared Services, right-click on the demand for Shared Services and try to remove the application from here

    3. stop Hyperion Shared Services and all the Windows of financial management processes and backups of the relational database of the two patterns.

    4. check the relational database of Hyperion Shared Services repository, in the "ces_apps" table and make sure that there are no lines containing the appname "EXAMPLE." If the line still exists you should enlist the help of Oracle Global Support software to clean Hyperion Shared Services before proceeding.

    5. it is possible to remove all content removed from the relational database of financial management application. Must be very careful when handling manually tables database that permanent damage can be done at the application and other applications if the wrong content is removed.

    (a) first remove all tables, indexes, sequences, and the package objects that begin with the name of the application
    (b) remove all tables starting HSV_appname_xxxxxx
    (c) remove all rows in tables referring to demand HSX_CLUSTER_xxxxx.
    (d) delete all the HSV_ACTIVITY_KILL_USERS, HSV_ACTIVITY_NO_ACCESS, HSV_ACTIVITY_SESSIONS and HSV_ACTIVITY_USERS and HSV_USERS_ON_SYSTEM lines that refer to the name of the application.
    (d) remove the line containing the name of the application from the HSX_DATASOURCES table.

    6. the next time that all Hyperion services are restarted, the application must be removed safely from Windows client.

    You can contact your DBA to write a query on how to remove it.

    Hope this helps,

    Thank you
    Charles Babu J

  • Read the table xmldata

    Hello

    I created the following contains only one column

    create the table book_inf (booksinf clob);

    the booksinf column contains the following xmldata
    <BOOKS>
      <BOOK-ID> I1001 </BOOK-ID>
      <BOOK-NAME> SQL </BOOK-NAME>
    </BOOKS>
    How to read the book id values and the book-name one by one using DBMS_LOB.

    can someone help me... ?

    You would be better using an XMLTYPE column to store your XML data.

    SQL> create table book_inf(booksinf XMLTYPE);
    
    Table created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1* insert into book_inf(booksinf) values (XMLTYPE('I1001SQL'))
    SQL> /
    
    1 row created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  select x.*
      2  from   book_inf
      3        ,xmltable('/BOOKS'
      4                  passing book_inf.booksinf
      5                  columns book_id   varchar2(20) path './BOOK-ID'
      6                         ,book_name varchar2(20) path './BOOK-NAME'
      7*                ) x
    SQL> /
    
    BOOK_ID              BOOK_NAME
    -------------------- --------------------
    I1001                SQL
    
  • WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1138: cannot read the table on page

    Hello community,

    We went just to ESXi 5.1.0 build-1021289. We have installed MEM 1.1.2 and used to configure all of the iSCSI network and has chosen to use our BCM57810 10G cards for unloading rather than use the SW initiator. We are currently on firmware 5.2.6.

    We now see this error constantly in the vmkernel logs.

    2013-05 - 04 T 21: 06:40.074Z cpu4:240833) WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1100:Invalid size package of page table (length 4096, 338 expected)
    2013-05 - 04 T 21: 06:40.074Z cpu4:240833) WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1138: cannot read the table on page
    2013-05 - 04 T 21: 07:08.085Z cpu4:240833) WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1100:Invalid size package of page table (length 4096, 2528 expected)
    2013-05 - 04 T 21: 07:08.085Z cpu4:240833) WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1138: cannot read the table on page
    2013-05 - 04 T 21: 07:08.091Z cpu4:240833) WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1100:Invalid size package of page table (length 4096, 2528 expected)
    2013-05 - 04 T 21: 07:08.091Z cpu4:240833) WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1138: cannot read the table on page
    2013-05 - 04 T 21: 07:08.099Z cpu4:240833) WARNING: dell_psp_eql_routed: PspEqlReadRoutingTable:1100:Invalid size package of page table (length 4096, 2528 expected)

    We did all the additional configurations generally suggested - disabled ACK delayed, disable LRO, iSCSI timeout.
    I can't tell if it's having an impact on our performance or reliability. He sees not to be. However, these errors constantly fill our vmkernel logs.
    Out of curiosity, I went our adapter SW config and I do not get these more. We would really prefer to use unloading iSCSI broadcom cards now that the frames are supported. Has anyone seen else this error or know how I could get more details about this?

    ESXi 5.1.0

    Build-1021289

    The problem is the new broadcom driver, when you use the mode of unloading iSCSI.  VMware and Broadcom to release a patch.   For now just use the iSCSI SW.

  • How to read the value of an independent textInput element inside the method?

    Hello

    I had a group of detail based on a readonly viewobject. I added an independent element textInput, you say, EndDate to this group that the user can enter a value inside. Now, when I run the app I select a row in the table and press a button that triggers a method inside a bean. My question is how I read the value in independent textInput (EndDate) within the method element?

    getTable () .getRowData () does not print the unbound attribute. It seems that it only contains attributes underlying viewobject

    I use JDev 11.1.1.4

    Kind regards
    Will do

    Will do,

    You can better create a transitional attribute for that in your view object, so you can use a regular expression #{row.bindings...} to get the value.

    Steven Davelaar,
    JHeadstart team.

  • How to read the data of BLOB and save to the file system

    Hi friends.

    I have called DEMO table there image stored as a BLOB. now my requirement is to know how to read the data of BLOB and saved in the file system. is there a procedure
    to read the blob object and stored in the file system. pls suggest me with an example.
    Thank you

    HI - don't know what version you have, but have a read through this:

    http://www.Oracle-base.com/articles/9i/ExportBlob9i.php

    Hoek link is to import the blobs in the db, it is export, to a file.

  • How to add the table radio button.

    Hello

    I want to update the record if I want that an option of button raduio shaped tabular .There is no option for tabular.
    How to add the table radio button.


    Thank you

    Published by: 805629 on February 3, 2011 04:56

    Use APEX_ITEM. BOX API in the definition of SQL query for the form of tables

  • READ the TABLE of another schema

    Hello
    pls help me.

    I want to read the table of another schema that is declared in the application of the apex.

    SELECT * FROM DBA_ROLE_PRIVS;
    (SELECT * FROM sys.) DBA_ROLE_PRIVS: auch bad)

    The owner of this table is SYS.

    Error: The Table is unknown or cannot be found.

    my real schema is GCs.

    How is the select statement for this case for reading in the table (or tableview) of another schema?
    many and many thanks for your help.
    TL

    The SYS schema is a special schema in Oracle. You must explicitly grant the user rights by selecting tables and views sys.

  • How to read the files on time capsule

    How to read the files on time capsule from iPad?

    Thank you

    Using an application like navigation on the iPad. More info here:

    Stratospherix - FileBrowser - overview

  • How to read the status of User1 DIP-switch with a cRIO FPGA chassis?

    How to read the State of the DIP switches on a FPGA cRio chassis?

    I work with a cRIO 9022... My idea is to put the system in "service" mode with USER1 switch to IT and communicate with the FPGA via the FPGA - GUI (VI) on the host computer instead via the RT module that is used in normal conditions.

    Any ideas? Unfortunately, I don't have an unused channel on the left... .and (as I know) cannot use the interface RS232 of FPGA.

    Many thanks in advance,

    Luke

    Hi, this is the correct information. You cannot read the FPGA of DIP-switch status. The only thing you could do is to use the function of Reading Switch.vi located under the range of functions-> real-> utilities RT time

    It's how you probably know side host RT and not the FPGA.

    Cordially Virginia

  • How to read the value of list boxes by iteration in a loop For?

    I have a lot of list boxes on the front of my VI. I want to know how to read the value of this combo with a loop boxes For. The point is that I don't know how to get the reference of each combo box in a loop.

    Any information would be welcome. Thank you!

    su27 wrote:

    I have a lot of combo boxes on the front of my VI [...]

    Be sure to close the references that you have finished with them.

  • How to read the VI Analyzer config file?

    Hello

    How to read the analuzer vi configuration file? I'm getting a lot of errors on the size of the front panel and I don't know what should be the size you want. Where is the maximum expected size of the specified front panel?

    Kaspar says:

    Hello

    How to read the analuzer vi configuration file? I'm getting a lot of errors on the size of the front panel and I don't know what should be the size you want. Where is the maximum expected size of the specified front panel?

    If you have VI Analyzer installed, you can load the configuration file and look at the section select the Tests. There is a test for the maximum size of front under front-> User Interface. The default value is the resolution of the current monitor of the PC (including multiple monitors). You can change to the desired option.

Maybe you are looking for