Ad Widget

Collapse

Can I Use a part of item to make an another item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sycoweb
    Junior Member
    • Mar 2016
    • 23

    #1

    Can I Use a part of item to make an another item



    Hello,
    is it a way to build an item, by using a substring of another item (text string) and convert it to a number?
    For example :
    Item1: "18145 1281 6.60 8.40 30.50 15.90 5282286 0 193174 0 4187 0 6784 216 0 0 104 448"
    Item2: 4th number of Item1. i.e.: 8.40

    Thank you for your tips.
    Syco
  • rodeur2080
    Junior Member
    • Nov 2019
    • 9

    #2
    Hi,

    I think you need use preprocessing (tab in create item form) for extract the value that you wish.

    Regards,
    Last edited by rodeur2080; 25-11-2019, 16:32. Reason: fix my english :)

    Comment

    • sycoweb
      Junior Member
      • Mar 2016
      • 23

      #3
      Originally posted by rodeur2080
      Hi,

      I think you need use preprocessing (tab in create item form) for extract the value that you wish.

      Regards,
      Good evening rodeur 2080,
      thank you for helping, and sorry for the delay, I was gone last week.
      I think I understood the dependence mechanism, but I don't see how to put the cutting rule to get the desired piece.
      I used for my resulting item:
      Type: dependent Item
      Type of information: Text
      Preprocessing:
      Preprocessing Step :
      Name : Regular Expression,
      First Box : WAN_IN ^ *. \ ([0-9] * \) * $.
      Second Box : \1
      NB: I want to get what follows 'WAN_IN:'

      It does not work: I get the following error:
      Item preprocessing step #1 failed: cannot perform regular expression match on value "xxxxx xxxxxx xxxxx" of type "string": pattern does not match

      Any idea ? Or little more help on the syntax to formulate the clipping by regex?
      Thank you in advance.
      Syco

      Comment


      • Atsushi
        Atsushi commented
        Editing a comment
        The first post did not have the word "WAN_IN", but what is the original string for retrieving the value?
    • sycoweb
      Junior Member
      • Mar 2016
      • 23

      #4
      Yes Atsushi,
      the reality is in my first message:
      Master Item1: "18145 1281 6.60 8.40 30.50 15.90 5282286 0 193174 0 4187 0 6784 216 0 0 104 448"
      Dependant Item2: 4th number of Item1. i.e.: 8.40

      The above error is a simple test, with a message formatted differently for the example:
      The main item is "ATM_IN: 18145 ATM_OUT: 1281 MBR_IN: 6.90 MBR_OUT: 8.30 ATT_IN: 30.50 ATT_OUT: 15.90 FEC_IN: 8468803 FEC_OUT: 0 CRC_IN: 326628 CRC_OUT: 0 HEC_IN: 7032 HEC_OUT: 0 WAN_IN: 568 WAN_OUT: 48 ETH_IN: 0 ETH_OUT: 0 SWI_IN: 88 SWI_OUT: 696 "

      And I'm trying to retrieve the 13th field, 568, behind WAN_IN: 568.
      Syco

      Comment


      • Atsushi
        Atsushi commented
        Editing a comment
        Please try use these regexp.

        ^([0-9]+) ([0-9]+) ([0-9]+\.[0-9]+) ([0-9]+\.[0-9]+)
        \4

        WAN_IN: ([0-9]+)
        \1
    • sycoweb
      Junior Member
      • Mar 2016
      • 23

      #5
      Hi all,
      Step by step, I finally found what I was searching for.
      The final setting :
      ^([0-9]+\.*[0-9]* ){12}([0-9]+\.*[0-9]*).*$
      \2
      And so I get my 13th field.
      Thank you so much for your help.
      Regards.
      Syco

      Comment

      Working...