Topic Options
#57575 - 07/17/20 01:23 PM Help with picking up a floating field
tbradley Offline
OL Guru

Registered: 05/03/11
Posts: 147
I need some help! I have an amount field that floats. It is in the same place horizontally but floats vertically. It could be on page 1 or 8. It is always at the end of the document so depending on the number of pages is where it will be. There is a title right before it always that says Due Us. I am currently finding the Due US so that I can add a little note to the bottom of the last page. What I need help with is picking up the amount field so it looks like Due Us 1,867.33 etc. How would I go about picking up that amount field so I can put it in a file. Any help would be GREATLY appreciated with this. Thank you!!

Top
#57576 - 07/17/20 02:18 PM Re: Help with picking up a floating field [Re: tbradley]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 651
Loc: Québec, Canada
What do you mean by " How would I go about picking up that amount field so I can put it in a file"?
You wan to extract that value from the data file and save it into another file?

If that is the case, then your best bet would be to do this in PlanetPress Watch through a script.
Simply read the data file line by line and check on each if the keyword "Due US" is found. If it is, grab it and the following amount up to 2 number after the decimal separator "." and store this in a Watch variable.

Code:

Set ObjFso = CreateObject("Scripting.FileSystemObject")
Set ObjFile = ObjFso.OpenTextFile(Watch.GetJobFileName)



Do Until ObjFile.AtEndOfStream
    StrData = ObjFile.ReadLine
    posKeyword = InStr(StrData,"Due US")
    if posKeyword > 0 then
      Watch.SetJobInfo 1,  Mid(StrData,posKeyword,(InStr(StrData,".")+2)-(posKeyword-1))
      Exit Do
    End if
Loop

ObjFile.Close


You might need


Edited by Jean-Cédric (07/17/20 02:41 PM)
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57577 - 07/17/20 02:36 PM Re: Help with picking up a floating field [Re: Jean-Cédric]
tbradley Offline
OL Guru

Registered: 05/03/11
Posts: 147
I never thought about doing it in Watch. I still am not sure how to pick it up. Like position 49-65. I get what you are saying about up to the 2 positions after the decimal but again, not sure how to do that. Do you happen to have any examples of what I am suppose to put in?

Top
#57578 - 07/17/20 02:42 PM Re: Help with picking up a floating field [Re: tbradley]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 651
Loc: Québec, Canada
Edited my previous post...look at it laugh
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57579 - 07/17/20 03:33 PM Re: Help with picking up a floating field [Re: tbradley]
tbradley Offline
OL Guru

Registered: 05/03/11
Posts: 147
THank you. I just run that as a script (Run Script) right? I'm sorry. I know enough to be dangerous. lol We use spool files from an AS400/IMBI system that is aweful. Planet press was basically used to "pretty up" the spool files before I got this job. I do alot more with it now but we still don't touch most of its potential!

Top
#57580 - 07/17/20 03:41 PM Re: Help with picking up a floating field [Re: tbradley]
tbradley Offline
OL Guru

Registered: 05/03/11
Posts: 147
ok I got it but it is getting this all in the field. Why is it putting the Due US in there (the pipe sign comes after the Due Us on the form so its basically part of the text)?
Due US | 3450.00


Edited by tbradley (07/17/20 03:59 PM)

Top
#57583 - 07/20/20 08:10 AM Re: Help with picking up a floating field [Re: tbradley]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 651
Loc: Québec, Canada
Quote:
What I need help with is picking up the amount field so it looks like Due Us 1,867.33 etc.

That is why, now if you don't want the keywords as part of it, then add the number of character of said keywords to the mid() function so it starts reading further right as so:
Code:
Mid(StrData,posKeyword+8,(InStr(StrData,".")+2)-(posKeyword+7))

where 8 is the length of "Due US |".
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top