Learn how to set up nested repeating groups in ABBYY FlexiCapture FlexiLayout Studio. Nested repeating groups can be useful in many ways, including collecting data from complicated tables where the table element cannot be used.
Hello. Today I’m going to show you how we add nested repeated groups in a repeating group scenario. We already covered another video where we just focused on one repeating group within a document, but sometimes we don’t get that luxury and we actually need to add what we call nested repeating groups to a FlexiLayout template, so that we can extract traditional repeating information on a document.
If you recall in this document, we have student information and then below each student, we have the class numbers along with some GPAs and other information we want to capture. So we added a repeating group already in our previous video where we’ve extracted just the student information. But now what we want to do is extract the class information along with some GPAs. So, the first steps that I’m going to do is I’m going to try to find some things that allow me to anchor things.
I’m going to use class number, because we’re going to extract the class number, I’m also going to use this word called entries, so that will help me get entries, and since those show up only once within the parent repeating group, I’m going to go ahead and add them at this base repeating group element. In this case, I’m just going to go ahead and give them some names. Since this is a static text, I typically give them just a name of S for static text and then I’ll do class number and then, of course, here we will use class number.
It’s very important that when we have cases like this where the label spans multiple lines, that we tell the software that. So, and the way that we do that is tell it to take spaces into account and permit multiple lines. Then, of course, as we typically want to do, is we want to just add a relationship here, so that it finds the class number text closest to, we’ll just call it the student element here. So, it’s going to look for this whole element here called the student element and we want it to find the one closest.
The other thing that does is allows it to order it from page top to bottom when we’re displaying them to ourselves or to the user. So that will show us how to get the class number. I’m also going to add the entries here, so we can extract the entries. So we’ll do something very similar. We want to tell it that we’re looking for entries and then, of course, just very similar, we want to tell the software that it’s kind of anchored back to the student.
Let’s go ahead and test this. So we’ll go ahead and just run a match and once again, as you’re familiar with now, you can see within this group, the first repeating group instance, we are now extracting this proper headers. I’m going to allow you to do description on your own after you’ve analyzed this video. Think about different ways that you could capture description. So that’s why we’re going to leave it out of this video. But you can see here, we’re finding the repeated information for the group.
So let’s go ahead and add our nested group. All we need to do is add an element within here called a repeating group. We’re going to give it just the name of RG2, so that we know this is the second repeating group. We’re going to keep it fairly simple here. We’re just going to tell the software that it’s above the average GPA and that it’s below the student. So now we know how to box in for each repeating piece of information, in this case the students, we can box in where this repeating group is located. Just above and below.
Okay. So now that we’ve done that, we want to extract these specific values here. That’s why we’ve previously grabbed the class number text and the entry’s text, so that’s going to kind of give us some secrets here. In this case, for class number, I’m just going to add what we call a character string element. The character string element gives us the ability to just find what we call regular expressions or certain patterns of alphabets within the software. Here we’re going to give this the name of class number. One thing I will do here that is very, very important is we want to tell the software to only find this in cases where it found a student. Or, in this case, we’ll go ahead and just use class number since we want to use that as an anchor. But in other words, if we don’t find class number, then we don’t want to return an empty repeating group.
We’ll just tell it here and so don’t find this class number, if we don’t find the text called class number within this repeating group. What I will do is go ahead and add a regular expression for this. This is three digits long. You can do that, just do three digits and that’s a digit there. Then you can tell the software that it, has a minimum value of three and a maximum value of three. So it’s going to look for a three digit long character. Then, of course, we like to, I always box in, as much as we can, each element so that the software knows kind of at the end of the day, a rectangle that it’s extracting. We’re going to tell it simply that it’s below the class number, so these values here for the class numbers is below this S class number key word that we’re using.
Next thing we will do is we will tell it that it’s left of the right. So we’re going to say that these are located to the left of the right side of class number. That’s how we do it, it’s going to be to the left of the right boundary of this element. Then, lastly, we kind of want to do the opposite way. We’re going to say it’s right of the left. Then, like we typically do, we just bring this back and we kind of anchor it back to the closest element that we can find, keeping them in proper order and we’ll do something like that so we can keep them in a good order there for us to preview.
So that will enable us to get the class number. If we match this and we dive into these, now you’ll see here. We’ll just go ahead and steal our first repeating group. If we see everything within our repeating group, we’re extracting all this information, and then we’re also extracting within the nested repeating group, those different class numbers as well. So, let’s go ahead and add the entries. Very similar process, it’s once again a character string. We’ll give it an intelligent name, like entries. Just like what we did before, however, we want to be very cautious about this and make sure we tell the software not to find it, or not to attempt to find it even, if it can’t find, in this case, the S class number, or the static value of class number.
We’ll just say don’t find it if it’s not found. In this case, we’ll just go ahead and tell the software that it’s just any part of the alphabet. So, any characters of the alphabet can be found in the entries field. Of course, if you were doing this in your production environment, or a production template, you may want to be more specific about that. Including using a regular expression there. In this case, I’m just going to go ahead and leave it alone and then lastly, once again, control the different elements in relations that we find it. Just like what we did before when we used class number, now we’re going to use the text of entries to kind of box in where we find it.
So, first off, we know that these are going to be found below the entries keyword. So look below. Go ahead and look to the left of the right of the word entries. And right of the left of the word entries. And we’ll go ahead and say that it’s closest to the class number. So now, if we go ahead and match these, we’ll see a fairly consistent results here that I think you’re going to like. So we’re not only grabbing the first repeating group, we’re also grabbing repeating information within each repeating group. Here I’ll just dive in to our first repeating group, or our first student. Of course, we found everything again and then if we dive in to each repeating group, on the nested side, you can see I’m now finding both class numbers here once again.
That’s a very good example and a very good situation where we would apply nested repeating groups when we don’t have very nice or pretty table or tabular formatted documents in order to return columns and rows, we can now use a repeating group to do that. Then, of course, we can use that information downstream when we’re ready to simply perform some sort of export and have them based on columns and rows.
I’m going to challenge you now to go ahead and set up description. There’s multiple different ways to do it, of course. You can use a character string. You can use what we call a region. But just think about a couple of different ways you can use what you’ve learned in the last couple of videos to extract the description on each repeating group. It’s not meant to trick you. But it’s more just different ways and brainstorming. There’s more than one way to skin a cat on this FlexiLayout, so if you do it differently, it does not mean you’re right or that I’m wrong. Or vice versa. So, go ahead and give it a shot or give some ideas, or make up your own sample and give it a shot. I think you’ll enjoy the flexibility that ABBYY has provided you within this FlexiLayout studio. As always, if we can be of any assistance to you, please reach out to us. We’d be thrilled to help you. Thank you so much.