I’m in the process of learning the DataMapper and I have a text file which has multiple reports. Each page is delimited by the FF character and I have set the boundary to whenever a certain text is found (“Balance Forward”) in a specific location. This is all working as I want it to.
What I can’t figure out is how to extract the detail lines. Each record can either be only 1 page or more than 1 page. Reports that are 1 page long don’t have any detail lines otherwise the rest of the pages contain the detail lines. The detail lines appear between line 19 and 58 on each page (except page 1).
I have setup the repeat to be based on “Extractor Property” where the “Vertical Position” is equal to 123. This only extracts the detail lines from page 2 but not anything after. What approach or variables can I use to extract the rest of the detail lines from the rest of the data pages?
Without seeing the actual data (or an accurate mock-up), I’d say your best bet is to find something on the details line, usually at a specific column position or range, and use that as a flag.
Than you repeat and extract data from the details lines when that flag is found.
The detail section is tricky because not all the lines have a dot (.) in the same column and there are lines which don’t have any data on them. The last detail section doesn’t have a “subtotal” word printed, or anything along those lines, just a dollar total where the period is in the same column as the period in the detail section. The only sure thing is that all detail lines are between line 19-57 on each page.
I was thinking maybe there is a way to use the module function ( currentLine mod 65 = 57) That would give me the end of each detail section on each page but I can only get it to work on page 2 and nothing after that.
Here is a blurred out screenshot of the typical detail section between lines 19-57.
Not to contradict you but seems like all the . and / of the date are in the same position. you could use that…no?
As for the subtotal, you can use Connect subtotal mechanism to count it.Or ge t the one from the data. Seems like subtotal, tax and total lines have a . in a specific position but no / for a date so that could be used as well.
Can you make a mock-up data file that matches you current dilemma exact positionning of the text, while removing any sensitive information and share it with us so we can play around with it?
I have 2 sample files that I can share which I have removed sensitive info from but i’m not able to upload an attachment since I have a new account. Is there some other way that I can share the files with you?
Thanks for returning an example config. Is there a way to extract all detail lines, including the blank lines and the lines that don’t have a date in the first column?
Additionally, in the current example, I would want the line that I have highlighted to be included in the extraction as it goes with the lines below it. How would I do that?
Yes but it depends what you want to do with them.
Do you want them as there own subrecord or should they be concatenated with the next/previous line with date?
I also noticed that in your example, some “detail lines” had text before and some after and some both. which one go with which one?
What I did what is starting point but it will problably need some fine tuning depending on what is what.
You’ll need to be more precise/explicit on what to do with each type of lines.
I don’t know if this would make it easier, but how would I setup the DataMapper to extract all detail lines, no matter what data they have. So always extract lines 19-57 from each page, starting on page 2, until the end of the record.
Awesome, thank you. I’ll study this further and try it against some real data.
Is there a way to see what value a certain variable contains? For example, is there a way to see what value steps.currentPage or steps.totalPages contains. In PlanetPress Suite we could print the contents of a variable to a log or screen. Are there any “hacks” like that available here?
Simply add this before the code that I already setup in your condition. Remeber that when using Javascript condition, the last line of code is the result of the condition that is why the logger cannot be the last line or you’ll have errors.