Hello all!
I have an issue where I have a single record (PDF), with multiple detail tables (the amount of detail tables is variable). I’m trying to map over each line in the table, capture that data, push the information to its own detail table, and then move onto the next table. This next table will again have its own detail table, as each table is of variable length.
How do I start a new detail record table, rather than append the next table into the same record.detail? Is this even possible? Is it possible to use dynamic naming when I’m choosing which record.detail to push to? (I tried to say record.detail[i], for instance, but could nto get javascript to work in that field.)
Thanks in advance.
1 Like
In order to change the name of the current detail table, or to specify a new one, you’ll need to modify the “Data Table” value in the Extraction Step.
For example, here we see the default ‘detail’ table.
But I want that detail to be named Invoice instead for organizational purposes.
So I just type a new name there. record.Invoice.
So in your case, you’re going to loop through the data representing record.Detail1, extracting all of the fields into that detail table. Then, in a different Data Extraction step, you’ll define record.Detail2, for example, and select all of the fields that will go into that one.
This can all happen in the same loop. But if you go the one loop method, you’ll have to build conditions to tell the two extract steps what to extract so you don’t get cross contamination between the two detail tables.
Alternatively, you can do one loop for each section of data. Each loop contains it’s own extraction step and only looks at the part of the data containing the information it should be extracting.
Yes, but what happens if I have a variable about of detail tables with variable amount of details?
Record 1
Table 1
Some Detail
Some Detail
Some Detail
Table 2
Some Detail
Some Detail
Table 3
Some Detail
The amount of tables, and the amount of details per table will vary for reach run through, but the format of each remains the same. Because of this, I would imagine a loop would be helpful. This is where I run into the issue of
Then, in a different Data Extraction step, you’ll define record.Detail2, for example, and select all of the fields that will go into that one.
I don’t know how many extract steps to use, because this will vary.
To give you the WHY of what I’m doing: I have a PDF which has these detail tables, and I need to capture all the information from each detail and put it into its own separate table so that I can reference that for rebuilding the PDF. Currently, multiple detail tables are on the same page. I need them to be on separate pages.
Also, I tried to follow the directions on this link: Extracting a multi-line item description - OL® Learn because what I’m trying to do is similar – I just need all the information from multiple lines in a single detail record (Treating everything as the “description” in this example.)
However, the “source” option is not available in the preprocessor step, as it mentions. Not sure if this is something different in 2018.2
Ah, I overlooked the Variable Number of Detail table tables, sorry.
If you don’t know how many Detail tables you have going into the file, then you must account for all possibilities.
For example, let’s say you’re working with telecom bill of sorts. The data comes through as line items and each one is coded with a category. A number at the start of the line, for example.
1 = Telephone charges
2 = Television charges
3 = Mobile Cell charges
4 = Internet Charges
Maybe some customers don’t have internet. Others don’t have television. In your datamapper, you don’t care. You simply look at each line condtionally. If 1, go down X path and extract into records.telephone. If 2, go down Y path and extract into records.Television. If 3, go down Z path… etc.
This way, for the customers without Internet, no data gets populated into record.Internet. But if they do have it, it ends up populated.
This can only work if you know all possible detail tables though. If you don’t, I don’t know of any way to dynamically create new detail tables on the fly. Even if you could, it would result in mismatching data models that would then not function with the templates they’re destined for.
I have an example of this if you’d like to see it. Just PM me your email address and I’ll send it over.
What you could do, instead of trying to generate dynamically detail tables, is to use two detail table, one nested in the previous one.
First ones holds the name of the “detail table from the data”, and the nested detail table which holds “data line from the data”.
Consider this data example:
Using these steps:
- A Goto to skip the first line
- A Repeat to go through each lines
- A Condition to check if it is a “data detail-table” lines
- If true, an Extraction that extract the “data detail-tables” line
- If false, an Extraction that extract the “data” line and stores it in the nested detail table named “Lines”
- A Goto to go to the next line
You would get the following:
Of course, should the number of level “data detail-tables” be dynamic, then this solution wouldn’t work.
That should steer you in the right direction.
Hey, thank you so much for this reply. Just trying to wrap my head around this. It appears to be just like what I’m looking for, however, I’m not understanding how the conditional makes it do this. So…For table 3 for instance, are all of those "Some Detail"s (8 in total) contained within its own nested table?
Yes they are.
When I’ve setup the extraction in the Extraction step in the false branch, I did defined a nested detail table as explained by my collegue @AlbertsN. See below:
I manually added the .lines after the record.detail in the Data Table field. This has created the nested detail table named Lines.
Now, in the detail table detail you will have the name of all you “data detail table” as well as the corresponding nested detail table lines which hold the respective “data lines” for each.
1 Like
Thank you SO much hamelj! (and albert). This worked and was exactly what I was trying to do. I’m still not sure why my previous attempt wasn’t nesting, but I’m glad it is now!