Jump to content
Server Maintenance This Week. ×

Revisited Issue: Parsing Text


Zcast

This topic is 5122 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey everyone,

I know this is a rather old topic on here and there are a few posts regarding a solution, but for the life of me, I can't get it to work. I was wondering if I could get a second (or third) opinion as to what I am doing wrong here,

1) Have a text field

2) I AM NOT able to parse the needed text from the text field using the formula provided by comment:

Let ( [

start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ;

end = Position ( text ; suffix ; start ; 1 )

] ;

Middle ( text ; start ; end - start )

)

This is my text string:

Transaction ID: 2DB113476E10274V984321

An email blah blah blah

So, this is my formula:

Set Field: "mytable:TranactionID" with the result of this:

Let ( [

start = Position ( mytextfield ; "Transaction ID: " ; 1 ; 1 ) + Length ( prefix ) ;

end = Position ( mytextfield ; "

" ; start ; 1 )

] ;

Middle ( mytextfield ; start ; end - start )

)

What am I doing wrong, as I am not getting ANYTHING into my transaction field, it stays blank. HELP!!

Link to comment
Share on other sites

I don't see how the calculation dialog let you close it. You've used a variable: prefix

But it was never defined. One way to fix is to define it:

Let ( [

prefix = "Transaction ID: ";

start = Position ( myTextField ; prefix ; 1 ; 1 ) + Length ( prefix ) ;

end = Position ( myTextField ; "

" ; start ; 1 )

] ;

Middle ( myTextField ; start ; end - start )

)

Link to comment
Share on other sites

This is what I did:

Let ( [

start = Position ( trans::contents ; "Transaction ID:" ; 1 ; 1 ) + Length ( "Transaction ID:") ;

end = Position ( trans::contents ; "

" ; start ; 1 )

] ;

Middle ( trans::contents ; start ; end - start )

)

After hours of it not doing anything, the moment I posted this, it began to work, however it won't work if I use it as a result of a "Set Field" script.

Link to comment
Share on other sites

I would post the simple file, but as I was "recreating" the issue, the "Set Field" script worked. Now I'm just going to go back through my actual solution, and see what I did different. Thanks to you and Fenton for your help, I appreciate it. UPDATE: Yep, stupid oversight on my part by not making the inteneded result field "global". Everything works fine now, and I have included the simple file for anyone else interested in seeing how to parse info using comments formula.

simple.zip

Edited by Guest
Updated
Link to comment
Share on other sites

This topic is 5122 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.