Question
How to read unstructured data from a text file
Hi,
i have a requirement to extract information from unstructured data from a text file. is there any way in Openspan other than C# code also it sems tricky using c# code . See the below sample data
Clearing Member Exchange Member Currency Account
------------------------------------------------ ------------------------------------------------ -------- -------
XXXXX - xxxxxxxxxx International Limited ACTEX - xxxxxxCapital Trading B.V. EUR P1
ProdType Product Tick Size TickVal
----------------------------- ------------------------------------- --------- ---------
FSTK - Stock Future FEUA - ABC COMPANY FUTURE 1 0.0100
Contract Detail PrvLng PrvSht MovLng MovSht CurLng CurSht PremVarMar Last Act
MktShL MktShS EffExpDat SynP LstSetlPrc SettlmPrc UndrPrc OCCId
- ---------------------------------------------- -------- -------- -------- -------- -------- -------- ----------------- --------
FEUA DEC 2017 0 100 0 0 0 100 11,000.00 26-01-16
0.00 0.32 18-12-17 4.61 4.50 4.46
FEUA DEC 2018 100 0 0 0 100 0 12,000.00- 26-01-16
0.86 0.00 17-12-18 4.64 4.52 4.46
-------- -------- -------- -------- -------- -------- -----------------
Total per Product 100 100 0 0 100 100 1,000.00-
-----------------
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
You can read the text using a StreamReader in an automation. You can add that to your automation using the Add Constructor for Type on the toolbar.
After clicking the button on the toolbar, click on an open spot on the automation. Select System.IO.StreamReader and the following will pop up.
You will need to set it up in Pega Robotics the same way as you would in code choosing the Constructor that takes a FilePath. Here is a simple automation that will read the entire file. You will need to add some steps at the end to parse the text. Notice this uses an infinite ForLoop and the Peek method of the StreamReader to determine when to exit.
So now you are reading the file and all that is left is to use Regex and some logic to parse the text. Not knowing your intent I can't show you that here. Most likely you will have to write a small script to process the regex if you want to return multiple groups from a line.