Sign in to follow this  
Followers 0
lilx

gathering multiple information blocks from 1 string.

5 posts in this topic

#1 ·  Posted (edited)

Hello guys,

I am here posted this topic because i have a question what is the best possible way to look for certain type of text into a single string every time.

For what do i need this solution. I am making at this point a little database for myself to keep up finance tracked into a database. Where in the future I can add some projects to it and logs files of my bank that I will import into the database and can see if they are paided or not and how many months etc etc.

Now here comes my question the log file that I download from bank account i have the description all scrambled. this description cell has some valuable information that I want to separate. In the cell they are separated with at least 2 spaces but some part of the information is using more then 2 spaces.

BEA NR:RW01 19.05.12/13.32 Gall & Gall 6663 ROD,PAS7

GEA NR:S407 19.05.12/23.57 DUAN 260 CAE/Y,PAS797

BEA NR:2T2 20.05.12/20.07 SEPAY-La Porta ALEN AA,PAS7

GIRO 288 BELST MND JU. NR. 21013 ZOAG 202 *GG *

BEA NR:07X0 21.05.12/15.27 Git se inf ROTA,PAS7

BEA NR:A01 22.05.12/12.47 Paekper Verpak. BAR,PAS7

BEA NR:P01 22.05.12/13.38 PKOR VERP. 'S-GR,PAS7

1.1.6.4 wers dr 110/ak

4.4.8.1 GN B I DEEN dsr 1033 AS Zog

6.9.9.9 DO BEK. 01 SRIG MI 2012 CRR.NR. 26-892-0-12

2.5.1.4 PYL (EUE) S.R.L BEM. QQL PA VIG

6.9.9.9 DO BEK. 0017 DO IG LSD 2012/LS 115 5DE TRMN

BEA NR:931 25.05.12/18.29 H.P. v Liten RO,PAS7

BEA NR:R1 26.05.12/18.00 Gll & Gll 63 RO,PAS7

BEA NR:7CH 26.05.12/18.19 SHL AR V RIV CE,PAS7

I have deleted some letters and nummers because of privacy issues but the whitespace are untouch

I hope you guys can see that every cell have different information saved into a string and depending on the action It has different information stored. So what I need is a piece of code that separates the string and do the following things:

1. Look if the first section starts with a bankaccount or a code

· BEA then it means I payed in a store with my card

· GEA I got some money out of the wall

· Bankaccount number I did send the money with a transaction.

2. Depending on what action it was, shows the following information

Transaction

· Bankacount number

· Named to

· Description

BEA or GEA

· Some bankcode

· Time

· Store/place

· Pas number

i hope i can get some information on how to get this working. the explanation is not written in the best english and my apologies for that.

Edited by lilx

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You could probably use the StringSplit function. This function - _FileReadToArray, might be used instead. See the String Management section in the Help file for the different functions there that can then be used to act on the individual elements.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hey,

Here is an example of how to parse your sample data.

There is not enough regular structure in the GIRO and account number lines (that I noticed) to parse those better, that's why it only splits it into account number and the rest of the line.

Hier heb je een voorbeeld van hoe je de regels zou kunnen parsen.

Voor de rekening nummer regels is er te weinig structuur (dat me opviel) om het beter op te delen, vandaar alleen het rekening nummer en de rest van de regel.

#include <Array.au3>


$sString = "BEA NR:RW01 19.05.12/13.32 Gall & Gall 6663 ROD,PAS7" & @CRLF
$sString &= "GEA NR:S407 19.05.12/23.57 DUAN 260 CAE/Y,PAS797" & @CRLF
$sString &= "BEA NR:2T2 20.05.12/20.07 SEPAY-La Porta ALEN AA,PAS7" & @CRLF
$sString &= "GIRO 288 BELST MND JU. NR. 21013 ZOAG 202 *GG *" & @CRLF
$sString &= "BEA NR:07X0 21.05.12/15.27 Git se inf ROTA,PAS7" & @CRLF
$sString &= "BEA NR:A01 22.05.12/12.47 Paekper Verpak. BAR,PAS7" & @CRLF
$sString &= "BEA NR:P01 22.05.12/13.38 PKOR VERP. 'S-GR,PAS7" & @CRLF
$sString &= "1.1.6.4 wers dr 110/ak" & @CRLF
$sString &= "4.4.8.1 GN B I DEEN dsr 1033 AS Zog" & @CRLF
$sString &= "6.9.9.9 DO BEK. 01 SRIG MI 2012 CRR.NR. 26-892-0-12" & @CRLF
$sString &= "2.5.1.4 PYL (EUE) S.R.L BEM. QQL PA VIG" & @CRLF
$sString &= "6.9.9.9 DO BEK. 0017 DO IG LSD 2012/LS 115 5DE TRMN" & @CRLF
$sString &= "BEA NR:931 25.05.12/18.29 H.P. v Liten RO,PAS7" & @CRLF
$sString &= "BEA NR:R1 26.05.12/18.00 Gll & Gll 63 RO,PAS7" & @CRLF
$sString &= "BEA NR:7CH 26.05.12/18.19 SHL AR V RIV CE,PAS7" & @CRLF

; Parse alle BEA en GEA regels. StringRegExp met flag 4 levert een array met arrays terug, dus geen 2D array.
; [0] = gehele match, [1] = GEA/BEA, [2] = NR:..., [3] = datum, [4] = tijd, [5] = winkel/locatie, [6] = pas
$aArray = StringRegExp($sString, "(?m)^([BG]EA)h+(NR:w+)h+([d.]+)/([d.]+)h+(.*?),(w+)s*$", 4)
For $i = 0 To UBound($aArray) - 1
    $aSub = $aArray[$i]
    _ArrayDisplay($aSub)
Next

; Parse GIRO en rekining nummer regels. (te weinig structuur om een beter pattern te schrijven)
; [0] = gehele match, [1] = rekening nr, [2] = ...de rest van de regel...
$aArray = StringRegExp($sString, "(?m)^([d.]+|GIRO)h+(.*?)s*$", 4)
For $i = 0 To UBound($aArray) - 1
    $aSub = $aArray[$i]
    _ArrayDisplay($aSub)
Next

* Comments are in Dutch as this is not likely to be used by any non Dutch people, the OP will likely understand it better.

Edited by Robjong

Share this post


Link to post
Share on other sites

Banking information? You can't understand the instructions because it's in a different language ... This is fishy.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

NO, if I undestand correctly this is like a log of transfers from his account, he wants to organize the data and needs to split it up in parts to do so, and it's his native language, Dutch.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0