Extract mid Value

Hi,

Please help me to extract mid value between "Full Name: & Address:" but if the value is repeated then i have to get first output and then second one. please find below text.

Input: As below

Employee Information
Full Name:
CHAANA MARINTI
Address:
KHAJA GUDA , MANIKONDA ,
HYDERABAD
Gender:
MALE
Mobile Number:
7536985
Full Name: Ssrinivas
Address:
Krajogula, Hyderabad
Mobile Number:
7536985


I want output to be
CHAANA MARINTI or
KHAJA GUDA , MANIKONDA ,
HYDERABAD

i just want in between values

Thanks
Ravi
 

Sachin_Kharmale

Active Member
Hi @ravikumarj023 ,

Use bellow code in code stage to extract text between two values as per your requirement,

1. Main Flow in Object Studio.
View attachment 1579675018302.png

2.Input Text Data Item.
View attachment 1579675039539.png

3.Code Stage Input.
View attachment 1579675057422.png

4.Code Stage Output.
View attachment 1579675066910.png

5.Code Stage Code.
View attachment 1579675084529.png

6.Output after execution of code stage Code.
View attachment 1579675127111.png

Use bellow Code.

C#:
string[] LinesText = inputText.Split('\n');
            string OutputText = "";
            Boolean flag = false;
            for (int i = 0; i < LinesText.Length; i++) {
                if (LinesText[i].Trim() == "Full Name:") {
                    flag = true;
                    i++;
                }
                if (LinesText[i].Trim() == "Address:")
                {
                    flag = false;
                }
                if (flag) {
                    OutputText = OutputText + " " + LinesText[i].Trim();
                }
              
            }
            Output=OutputText;
I hope it will help you.
 
Hi @ravikumarj023 ,

Use bellow code in code stage to extract text between two values as per your requirement,

1. Main Flow in Object Studio.
View attachment 5105

2.Input Text Data Item.
View attachment 5106
3.Code Stage Input.
View attachment 5107
4.Code Stage Output.
View attachment 5108
5.Code Stage Code.
View attachment 5109

6.Output after execution of code stage Code.
View attachment 5110

Use bellow Code.
C#:
string[] LinesText = inputText.Split('\n');
            string OutputText = "";
            Boolean flag = false;
            for (int i = 0; i < LinesText.Length; i++) {
                if (LinesText[i].Trim() == "Full Name:") {
                    flag = true;
                    i++;
                }
                if (LinesText[i].Trim() == "Address:")
                {
                    flag = false;
                }
                if (flag) {
                    OutputText = OutputText + " " + LinesText[i].Trim();
                }
             
            }
            Output=OutputText;
I hope it will help you.
Hi @Sachin_Kharmale

"FullName" is repeted so result am getting as "CHAANA MARINTI Ssrinivas"


Input: As below

Employee Information
Full Name:
CHAANA MARINTI
Address:
KHAJA GUDA , MANIKONDA ,
HYDERABAD
Gender:
MALE
Mobile Number:
7536985
Full Name:
Ssrinivas
Address:
Krajogula, Hyderabad
Mobile Number:
7536985


I want output to be Individually.

Thanks for the reply and please help me out to solve this issue.
 
Top