How to split strings?

Hello

I'm using action made by Christophe (http://www.vcoteam.info/learn-vco/code-snippets-cancel-one-of-your-running-workflows.html) in order to cancel some workflows.

Since the selection for tokens window does not display the parameters of the token, I created another entry for my workflow that is supposed to contain the name of the virtual machine, only for infomational purposes.

I created an action to do this. When I use just "return myWorkflowToken.getInputParameters ();" then all settings are written to the input box.

In my case, it looks like this:

{ram = 3000.0, date = Mon Jan 24 16:25:16 THIS 2011, vm = < @id = FinderResult' VC:VirtualMachine/si0vm271/vm - 852' @name = "si0vm562" >, UC = 3.0}

Since I need only the name of the virtual machine, in this case the part after @name (si0vm562), I need to retrieve it somehow off the chain.

In the Orchestrator API, I found the String class with the method 'split '.

At first, I tried to split the string into two parts using this code:

var params_s = myWorkflowToken.getInputParameters ();
var params_a_s = params_s.split ("name");
return params_a_s [1];

But when I run the workflow, the input dialogue tells me that the "split" function cannot be found.

How can I retrieve the VM name on the report of a running workflow?

Thank you

Concerning

Andreas

Hi Andreas,

I don't think that splitting strings works for your case.

In fact workflowToken.getInputParameters () does not return a string. It is ch.dunes.scripting.jsmodel.JSProperties instead (you can check this of the Orchestrator client tools-> API Explorer). The split function is not found on the params_s variable.

In order to achieve your goal, you can try the following:

get the vm parameter

Use the parameter name. This is the vm used according to the result of your message

VM var = workflowToken.getInputParameters () .get ("vm");

You can check for safety if the virtual machine is defined, except that the virtual machine is the required parameter

If (vm! = null) {}

return vm.name

}

The code snippet above you should return the value set for the parameter of the virtual machine.

Hope this helps,

Martin Marinov

Tags: VMware

Similar Questions

  • How to split string separated by commas and pass to the clause of the select statement

    Referring to article How to divide string separated by commas, then pass to clause of a select statement, tquery that there the following plan:

    Query1:

    select * from emp where ename in (
        select regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) from dual
        connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null );
    

    Base1:

    Plan hash value: 4242290184
    
    
    --------------------------------------------------------------------------------------------
    | Id  | Operation                       | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                |          |     1 |   133 |     7  (29)| 00:00:01 |
    |*  1 |  HASH JOIN                      |          |     1 |   133 |     7  (29)| 00:00:01 |
    |   2 |   VIEW                          | VW_NSO_1 |     1 |    46 |     3  (34)| 00:00:01 |
    |   3 |    HASH UNIQUE                  |          |     1 |       |     3  (34)| 00:00:01 |
    |*  4 |     CONNECT BY WITHOUT FILTERING|          |       |       |            |          |
    |   5 |      FAST DUAL                  |          |     1 |       |     2   (0)| 00:00:01 |
    |   6 |   TABLE ACCESS FULL             | EMP      |    14 |  1218 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       1 - access("ENAME"="$nso_col_1")
       4 - filter( REGEXP_SUBSTR ('SMITH,ALLEN,WARD,JONES','[^,]+',1,LEVEL) IS NOT NULL)
    

    However, the following query generates the plan I want:

    Query2:

    select * from emp where ename in ('SMITH','ALLEN','WARD','JONES');
    

    Plan2:

    Plan hash value: 3956160932
    
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |     4 |   348 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |     4 |   348 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       1 - filter("ENAME"='ALLEN' OR "ENAME"='JONES' OR "ENAME"='SMITH' OR
                  "ENAME"='WARD')
    

    Can I change the query1 query for plan2?

    As Juliet was mentioned in the first SQL that you generate from the ENAME list that you must pass in the IN clause when executing. But in the second SQL, it passed as a static value. So first SQL must do more work. So you see a different execution plan.

    But this is a work around to get what you are looking for. But I can't say it's a foolproof method. But anyway here you go.

    SQL > var ename_list varchar2 (100)
    SQL > exec: ename_list: = 'SMITH, ALLEN, WARD, JONES ';

    PL/SQL procedure successfully completed.

    SQL > select *.
    2 of PEM
    where the 3 «,» | : ename_list | ',' like '%', | Ename | ',%';

    EMPNO, ENAME, JOB HIREDATE DEPTNO ID COM SAL MGR
    ---------- ------ --------- ---------- --------- ---------- ---------- ---------- ----------
    7369 SMITH COMMITTED 7902 2975 2 APRIL 81 0 20
    7499 ALLEN 7698 1600 20 FEBRUARY SALESMAN 81 300 30
    7521 WARD 7698 1250 22 FEBRUARY SALESMAN 81 500 30
    7566 JONES MANAGER 7839 2975 2 APRIL 81 0 20

    SQL > select * from table (dbms_xplan.display_cursor);

    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------------------------------
    SQL_ID, 848zhvbvgf7d6, number of children 0
    -------------------------------------
    Select * from emp where «,» | : ename_list | ',' like '%', | Ename
    || ',%'

    Hash value of plan: 2872589290

    --------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |      |       |       |     2 (100) |          |
    |*  1 |  TABLE ACCESS FULL | EMP |     1.    38.     2 (0) | 00:00:01 |
    --------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 - filter(','||:ENAME_LIST||',' LIKE '%,'||") ENAME "|", %')

    19 selected lines.

    SQL >

  • Split string on the new line

    G ' Day,.

    I am writing a process that takes as input a multiline string. I need to chop this string through line breaks and iterate over each of them, but I can not work how to split a string based on the line breaks and TEO reference Guide is sufficiently vague as to what special characters (if any), you can split a string on.

    This process is intended to be launched directly via TEOWebConsole at this point else I would implement it in CCP instead.

    Thoughts?

    You can use the regular expression ^. * $

    and then feed in the chain and the loop and then through it, cut the ends and go from there.

    I have a TAP of some commonly used functions that I use in many of my automation. I call the function automation tools. I downloaded the zipped here tap. Download, unzip and import.

    It has a function called multiline convert to single-line string. While that might not be exactly what you're doing, you can remove the pieces of the rupture in the line break and be ok I think.

    Here is a screenshot of what I mean:

    -shaun

  • Split string

    Dear Sir

    Is there a simple function like string.split

    I want to just split this string 384; 603; 107; 38

    Rgds

    Nadir

    and this thread can also help you:

    http://supportforums.BlackBerry.com/T5/Java-development/how-to-split-a-string-in-to-a-string-array-w...

  • How to split the screen of my mac book

    How to split the screen of my Macbook?

    There may be a solution on how to split the screen into two (halves) for independent display

    through the use of third-party software options. I haven't tried everything, but have read of some who can work.

    Such a "solution party' appears in the Mac App Store; See the second link to the manufacturer.

    https://iTunes.Apple.com/us/app/split-screen/id453757310?MT=12

    • Split screen - Mac app for windows (approximately $7 USD) display management

    http://www.splitscreenapp.com/

    There may be others, beware of questionable sources, as they may contain others? content.

    This may work on a Mac, not a portable desktop computer:

    • Apple introduced mode split for the apps full screen on a Mac in OS X El Capitan - 9to5Mac.com:

    http://9to5Mac.com/2015/06/08/Mac-split-screen-multitasking/

    In any case...

    Good luck & happy computing!

    under the direction

  • How to convert string to number in TS?

    Hello

    Anyone know how to convert string to number in TS?

    I couldn't find the Num() function.

    Thank you

    Val()

  • How to split audio data in images after reading a file

    Hi im a student of final year done my project in speech recognition using labview. could someone help me with how to split an audio data in image file for further processing.

    You could read wav files in LabVIEW using these VI: http://zone.ni.com/reference/en-XX/help/371361H-01/lvpict/sfilevis/ once you've read, divide the waveform in the picture of your choice.

    Before you return to the report on not enough memory, please read this: http://forums.ni.com/t5/LabVIEW/not-enough-memory-to-plot-wav-file/m-p/754592

    Search results: http://search.ni.com/nisearch/app/main/p/bot/no/ap/global/lang/en/pg/1/ps/30/q/wav%20file/

  • How to split a video for use with Windows Movie Maker

    movie maker help?

    my video is too long, so he used open, does anyone know how I can divide or shorten it so I can open it in movie maker?

    Thanks :)

    my video is too long, so he used open, does anyone know how I can divide or shorten it so I can open it in movie maker?

    Thanks :)

    ===============================================
    Are you sure that is the problem and not an incompatible format?

    In any case... the following freeware might be worth a try:

    VirtualDub
    http://www.videohelp.com/tools/VirtualDub
    (left click of he who said):
    "Download from mirror (direct link) (1.3 MB)")
    (installation is not necessary... just unzip)
    and run it by clicking left VirtualDub.exe)

    VirtualDub: Splitting AVI files
    http://www.Afterdawn.com/guides/archive/cut_avi_with_virtualdub.cfm

    VirtualDub: How to split the video
    http://www.ScreenVirtuoso.com/VirtualDub-split-video.html

    Video editing tutorial - using VirtualDub
    http://www.astahost.com/info.php/video-editing-tutorial_t11655.html
    > not compatible with .wmv or .asf files

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • How to split screens

    How do split you screens so that 2 different screens can be viewed at the same time?

    Hi DSchlict,

    Rather than waiting for your answer to the question of GBorn, I think that it might be two windows you want to see at the same time on the same screen? If so, right-click on the task bar and choose Show Windows side by side. That way you can jump between the two.

    Note: it does not work with Internet Explorer if you have all your sites open in tabs. In this case, you will need to open each site in a new window.

    I hope that one of the two answers works for you. Let us know?

    All the best,

    Sharon

    Sharon Roffey
    Queensland, Australia

  • How to split the PHONE NUMBER in the column of database?

    Hello - how to split the telephone within the same column number?

    Existing column PHONE data

    3711943

    8744723

    8487928

    3349262

    I want to split the data in the same

    371-1943

    874-4723

    etc...


    Is this possible? I need to do this only through SQL query not PL/SQL.



    SUBSTR (your_col, 1, 3). » -'|| SUBSTR(your_col,4)

  • Reg: Split string

    Dear all,

    Oracle Database 11g R2 11.2.0.1 SE1

    Consider the string

    Madhu, no. 34 Church street, main road, TMK

    I need to trim the string based on the conditions below.

    Condition 1: Split string 35 characters each

    Condition 2: Search until the previous by commas and visualize up to comma.

    Condition 3: split to then 35 characters.

    Power required for the highest chain

    Addr1 Addr2
    Madhu, no. 34 Church streetmain road, TMK

    Comment:

    Condition 1: Addr1-> 35 char = Madhu, no. 34 Church street, main ro

    Condition 2: Addr1-> comma previous search-> out-> Madhu, no. 34 Church street

    Condition 3: Addr2-> search for then 35 characters (i.e. "main road")-> 1-> Condition 2 Condition

    Please help in this regard.

    What's easier:

    with t
    as
    (
    select 'Madhu, No 34 Church street, main road, TMK' addr
      from dual
    )
    select substr(addr, 1, instr(addr, ',', -(length(addr) -35)) - 1) addr1,
          substr(addr, instr(addr, ',', -(length(addr) -35)) + 1, 35) addr2
    from t
    
  • How to convert string input streams

    Can someone tell me how to convert string input streams...

    There are multiple ways. I will list down few of them.

    With the help of the old solution and standard java.

    publicstaticString fromStream(InputStream in)throwsIOException

    {

       BufferedReader reader =newBufferedReader(newInputStreamReader(in));

       StringBuilder out =newStringBuilder();

       String line;

       while((line = reader.readLine()) !=null) {

           out.append(line);

       }

       returnout.toString();

    }

    returnsb.toString();

    If you use Google-Collections/guava-

    InputStream stream = ...

    String content = CharStreams.toString(newInputStreamReader(stream, Charsets.UTF_8));

    Closeables.closeQuietly(stream);

    If you use the common Apache library... then it is worthwhile.

    StringWriter writer =newStringWriter();

    IOUtils.copy(inputStream, writer, encoding);

    String theString = writer.toString();

    Quick way but only work during deserialization.

    String result = (String)newObjectInputStream( inputStream ).readObject();

    Note: ObjectInputStream is on deserialization and the flow of data must respect the Protocol of serialization to work, which may not always true in all cases.

    Ultimately, the most effective solution and only in two lines using java class Scanner.

    Tricky is to remember the \A regex that matches the beginning of the entry. It actually indicates Scanner to mark all of the flow, from start to beginning next (illogical).

    publicstaticString convertToString(InputStream in) {

       java.util.Scanner s =newjava.util.Scanner(in).useDelimiter("\\A"); 

           

       returns.hasNext() ? s.next() :"";

    }

    Read more: http://www.techartifact.com/blogs/2013/11/how-to-readconvert-an-inputstream-to-a-string.html#ixzz2lvy5muix

  • How to split a PDF into smaller files using Acrobat XI

    How to split a PDF into smaller files using Acrobat XI?

    Hi laforcej

    Open the PDF in Acrobat...

    Go to tools-> Pages-> extract

    Now, select the Page number, you want to extract and save

  • How we split the screen for different horizontal and vertical divisions

    Hello

    How we split the screen for different horizontal and vertical divisions. I can't use panelSplitter because I need fixed screen and not the division which is movable/sliding. I tried inlineframe, but which fails because you cannot use forms, other trees components... :(

    so I would like to know how to do division without panelSplitter.

    Thanks in advance,
    Jyothi

    Hi Jyothi,

    If you set the panelSplitter attribute disabled to true, the delimiter becomes permanent/mobile no.

    
    

    Kind regards
    Amélie Chan

  • How to split a string into several substrings parent using a delimiter

    Hello

    I am forced to split a string into several substrings parent using a delimiter.

    And insert these substrings in variuou of the columns of a table in a row.

    For example. The sting is: ABC * DEF * GHI * JKH *.

    where ' *' is the separator.

    Desired output:

    Col1 Col2 Col3 Col4 Col5

    -------     --------     --------     -------     ---------

    JKH GHI ABC DEF (null)

    Could you please guide me how can I achieve this.

    Thank you

    Bogoss

    Hello Salim,

    Leave the thread for reference... got this excerpt:

    with t as

    (

    Select "c: its: hgfd:1:23" Str

    )

    Select

    REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 1, null, 1) col1

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 2, null, 1) col2

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 3, null, 1) col3

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 4, null, 1) col4

    , REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 5, null, 1) col5

    t;

    This code snippet works well, but for the fixed columns. Here are 5 predefined columns.

    But I need to have a logic that I can browse the string any No.. sometimes.

    For example. If I get 3 secondary channels of the parent chain... I need to insert into 3 columns.

    And if I get 6 strings under... I need to insert into 6 columns.

    Could you please help me develop a logic like that.

    I use Oracle database 10g.

    And the data are currently being collected on external table... but I can store in a variable or a column of a database table.

    Thank you

    Bogoss

Maybe you are looking for