How to put end of length to another text


#1

sd.xaml (8.5 KB)
Above is my proj. In it, I am trying to get text ‘A’ text position and output the rest of words after the ‘A’. However, in extract.Substring(extractPos + “810589-AAB”.Length), it gets like 100 words after it, Thus, I want to set another text as B and get all the words in between A and B. How can I go about it?


#2

@sangasangasanga
Try to use Split activity.
extract.tostring.split("-"c).Last
You will get “AAB”


#3

Hi maybe I wasn’t very clear with my question.
For example below is my extract text. I want to get the words in between from the first text “S10589-AAB” to another text “Weekly/Monthly File”. But when i do .Length it just gives me all the text following. I only want till another text. How can i go about it?

G-CLOUD NO S10589-AAB Apple Innc
Ge Compute Service (asda, 4 vCPU 8GB, 99.5%) 01 Jun 2018to 30 Jun 2018 1,094.74
Ge Storage (SADADTDAFRA, 5DFeAW0DAC0GB) S1agaerg89-AAB-AAC 01 Jun 2018to 30 Jun 2018 121.06
Ge Storage (SDFAADFTA, 5ADFCADFGAFB) S1589-afsr 01 Jun 2018to 30 Jun 2018 13.16
Ge Operating Sys (0arwgragaeg8R2 EE) 01 Jun 2018to 30 Jun 2018 57.90
Ge Apps (MicrosoftWarwgragrS) 01 Jun 2018to 30 Jun 2018 0.00
Ge NSS2 Svr Admin Svc (99.5%) (10 Units) 01 Jun 2018to 30 Jun 2018 299.80
PPRDEFwfRFWRFWEBO1
G NSS4 Web SVR SVR Svr S/W Admin Svc (929.5%) (13 Units) 01 Jun 2018to 30 Jun 2018 252.06
PPRDWEBO1
G BR1 Data Backup (Weekly/Monthly File) Jun 2018 124 GB(s) 105.40
G BR1 Data Backup (Daily File) Jun 2018 119 GB(s) 101.15
Total for S105AWFDAR89-AAB 2,045.27


#4

@sangasangasanga try below command. It will give u required output

var.Split({“S10589-AAB”,“Weekly/Monthly File”},StringSplitOptions.None)(1)


#5

Hi it works thanks but however, instead of returning 10 lines, It only return like 2 or 3 lines at the top even though the ‘(Weekly/Monthly File)’ text is below


#6

@sangasangasanga u can split the string wrt newline and then u can write required number of lines anywhere u want.


#7

Oh i see. How do you split the string by newline. Is it like split.(" ")


#8

@sangasangasanga use any of the methods for splitting text wrt newline

Urvariable.split({Environment.Newline},StringSplitOptions.None)

Or

Split(Urvariable, Environment.Newline)


#9

Hi,
You can use regular expression to using space count.
Regards
Bagish ojha


#10

@Manjuts90 Hey I tried implementing youways not working exactly how i want it to be
1)
s = extract.Split({“10589-AAB”,“G BR1 Data Backup (Weekly/Monthly File)”},StringSplitOptions.None)(1)
lack of lines
2)
pos = extract.IndexOf(“G-Cloud S10589-AAB”)
txt = extract.substring(pos + "G-Cloud S10589-AAB).length)
txt2 = txt.split({Environment.Newline},StringSplitOptions.None)
txt2.toString - message box
not sure as output is System.string[]


#11

@bagishojha Hi, how may I go about doing that?


#12

@sangasangasanga In your example txt2 is array, u can’t display array like string.


#13

@Manjuts90 Any other ways for me to double check the array?


#14

@sangasangasanga

I didn’t get you?


#15

I am trying to split by the new lines then limit it to 12 lines only. I want to display it to make sure it is correct
@Manjuts90


#16

@sangasangasanga if u want to display the lines use loop.


#17

firstly use a array string

yourstring.tostring.environment.newline
then
store your string into a array string variable
then
use that variable and start a loop

for
{
start to end string

then
manipulate your string
using regular expression and split with environment.newline

}

Regards
Bagish


#18

@Manjuts90 @bagishojha

I want to find the text “S10589-AAB” and get the following texts till “total for s10589-AAB”. which is about 12 lines. However, as the output only returns 3 random lines from there. I want to specify to get the first text that matches the text.
I attached my codes and pdf file so maybe it is easier for yall to get what i am saying.

sd.xaml (17.6 KB)


#19

can you show me this by converting into a text file

thanks
bagish


#20

@bagishojha i added some random characters to conceal certain parts
SERVICE GROUP: $10589
G-CLOUD NO S10589-AAB
G Compute Service (MAZavwjebWke) 01 Jun 2018to 30 Jun 2018 1,36094.74
G Storage (arwbtehbenB) S10589-AAB-AAC 01 Jun 2018to 30 Jun 2018 1346221.06
G Storage (TNBGEDN) S10589-AAB-AAB 01 Jun 2018to 30 Jun 2018 132463.16
G Operating Sys (08SNDGNHDN hdmzaetaR2 EE) 01 Jun 2018to 30 Jun 2018 53467.90
G Apps (MiczghsrhtrosohsftWizgdhzdhndows HS) 01 Jun 2018to 30 Jun 2018 0.00
G NSfhzdgbgdbgnmin Svc (99.5%) (1 Units) 01 Jun 2018to 30 Jun 2018 234599.80
PPRDWEBO1
G NSS4 Wfdhbhzdhfzfdgdmin Svc (99.5%) (1 Units) 01 Jun 2018to 30 Jun 2018 253452.06
PPRDWEBO1
G BR1 Data Backup (Weekly/Monthly File) Jun 2018 124 GB(s) 1034525.40
G BR1 Data Backup (Daily File) Jun 2018 119 GB(s) 1032451.15
Total for S10589-AAB 2,032425345.27
G-CLOUD NO S10589-AAC
G Compute Service (Hdzhbhsrnhfsnyfyjyxr.5%) 01 Jun 2018to 30 Jun 2018 1,4724353.69
G Storage (SAzdfhahghrea) S10589-AAC-AAC 01 Jun 2018to 30 Jun 2018 1234521.06
G Storage (zdfhth50hgaaetdGB) S10589-AAC-AAB 01 Jun 2018to 30 Jun 2018 13345.16
G Operating Sys (0fhszehsthsrttgrz8R2 EE) 01 Jun 2018to 30 Jun 2018 53457.90
G NSzdhbdghndgstghmin Svc (99.5%) (1 Units) 01 Jun 2018to 30 Jun 2018 2943569.80
PPRDAPP01
G NSSS AdshbzdgbdbzW Admin Svc (99.5%) (1 Units) 01 Jun 2018to 30 Jun 2018 4234650.66
PPRDAPP01
G BR1 Data Backup (Weekly/Monthly File) Jun 2018 264 GB(s) 2234264.40
G BR1 Data Backup (Daily File) Jun 2018 5 GB(s) 245354.25
Total for S10589-AAC 2,346111665664564.92