2 Replies - 176 Views - Last Post: 27 December 2017 - 07:06 AM Rate Topic: -----

#1 kramzuryc03  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-July 17

Read Specific line and display it on textbox

Posted 26 December 2017 - 11:29 PM

Hi all can you help me with this project

i have i text file and i want to filter certain string and then show the output on the another textbox

here is the file

<10/31/2017 05:49:49> AMOUNT 2300000 ENTERED
<10/31/2017 05:49:49> TRANSACTION REQUEST AAB
<10/31/2017 05:49:49> TRANSACTION REPLY NEXT A24 FUNCTION E021B036C036D013
<10/31/2017 05:49:52> CARD(0000844XXXXXX166) TAKEN
<10/31/2017 05:49:59> CASH REQUEST: 23
05:49:59 CASH 1:1,23;
<10/31/2017 05:50:04> CASH PRESENTED
<10/31/2017 05:50:07> CASH TAKEN
10/31/17 05:58 04021001 SILAY EO SILAY NEG OCCPH
CASH WITHDRAWAL CHK C:4748********1665 S:175948
A:0000000475081528 R: P23,000.00 P23,000.00
TB: 33,458.38 AB: 33,458.38
E: TRANSACTION COMPLETE

<10/31/2017 05:51:58> AMOUNT 400000 ENTERED
<10/31/2017 05:51:58> TRANSACTION REQUEST AAA
<10/31/2017 05:51:58> TRANSACTION REPLY NEXT A24 FUNCTION E021B036C036D013
<10/31/2017 05:52:01> CARD(0000844XXXXXX590) TAKEN
<10/31/2017 05:52:05> CASH REQUEST: 04
05:52:05 CASH 1:1,4;
<10/31/2017 05:52:09> CASH PRESENTED
<10/31/2017 05:52:12> CASH TAKEN
10/31/17 06:00 04021001 SILAY EO SILAY NEG OCCPH
CASH WITHDRAWAL SAV C:4748********5906 S:175950
A:0000002976103257 R: P4,000.00 P4,000.00
TB: 28,038.46 AB: 28,038.46
E: TRANSACTION COMPLETE


i want to filter certain file if there is "AMOUNT" string i should be copy on the another textbox for example
i click the button the output should be this only

<10/31/2017 05:49:49> AMOUNT 2300000 ENTERED
<10/31/2017 05:49:49> TRANSACTION REQUEST AAB
<10/31/2017 05:49:49> TRANSACTION REPLY NEXT A24 FUNCTION E021B036C036D013
<10/31/2017 05:49:52> CARD(0000844XXXXXX166) TAKEN


<10/31/2017 05:51:58> AMOUNT 400000 ENTERED
<10/31/2017 05:51:58> TRANSACTION REQUEST AAA
<10/31/2017 05:51:58> TRANSACTION REPLY NEXT A24 FUNCTION E021B036C036D013
<10/31/2017 05:52:01> CARD(0000844XXXXXX590) TAKEN


it will display only the 3 lines under the amount entered so on and so forth

TIA

Is This A Good Question/Topic? 0
  • +

Replies To: Read Specific line and display it on textbox

#2 Radius Nightly  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 207
  • Joined: 07-May 15

Re: Read Specific line and display it on textbox

Posted 27 December 2017 - 12:16 AM

I would do it by searching the strings.

Lets say that text are in some.txt file, load it and in single repeat/loop/for search for every <##/##/#### ##:##:##> AMOUNT # ENTERED, on hit, when its found, take that line number and check next three lines, if there are request, reply and taken, print them (show in another textbox). Continue until the last line of this some.txt are hit.

Sounds complicated, but its not.
Was This Post Helpful? 0
  • +
  • -

#3 Radius Nightly  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 207
  • Joined: 07-May 15

Re: Read Specific line and display it on textbox

Posted 27 December 2017 - 07:06 AM

You open another same thread before 6 months. Dont open again duplicated threads, its easier to bump it.

I made in another language what you need using table and old code i modified, there are better ways. However, you will have to write your own code, so maybe this is gonna help you, with lots of comments, easy to read and understand the code.

This is a code.
And this is text thats located in transactions.log, thats actually your whole first post and its gonna be used for what you need.

If you wanna locate your own file (thats not transactions.log), just delete it and you will be prompted at code execution (there will be print for this files you select). I added line numbers where hit happens, easy to remove, and when he find "amount" string, if in the next 3 lines missing "Request" and/or "Reply" and/or "Taken" it will print thats this "amount" doesnt contain it, You can define less or more then this 3 strings, he will search them all in order, for everything else, read comments in the code.

Top left corner are used to show the code (#) and to execute it (>) with output thats gonna be in output.log.

Download here: dic_example.zip

This post has been edited by Radius Nightly: 27 December 2017 - 07:43 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1