question

sittinun avatar image
sittinun asked sittinun posted

multi line table

I'm try to create the response map for output below:

 

Vlan      Group                    Type        Version     Port List
-----------------------------------------------------------------------
1         224.1.1.20               user                    Fa0/1, Fa0/2,
                                                                   Fa0/3
1         224.1.1.30               user                    Fa0/1, Fa0/4
10        224.1.1.20               user                    Fa0/2
10        224.1.1.30               user                    Fa0/3

 

 I have created the table for this but it got the values are Fa0/1, Fa0/2 for the first line and the value is Fa0/3 for the seconde line. I want to get the value for port list of the first row "Fa0/1, Fa0/2, Fa0/3".

iTestresponse map
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sittinun avatar image
sittinun answered sittinun posted

Hi PaulD

 

If Version values didn't show in line and some time that show, if use the pattern, it alway match all tokens. please advise me

 

Vlan      Group          Type        Version     Port List
-------------------------------------------------------------
1         224.1.4.4      igmp                    Gi1/0/11
1         224.1.4.5      igmp                    Gi1/0/11
2         224.0.1.40     igmp        v2          Gi1/0/15
104       224.1.4.2      igmp        v2          Gi2/0/1, Gi2/0/2

                                                            Gi2/0/2
104       224.1.4.3      igmp        v2          Gi2/0/1, Gi2/0/2

 

2 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KumarS avatar image KumarS commented ·

sittnun

 

Most likely in the original map, version column was empty. So the pattern map Paul gave you must not have taken care of that. Why don't you open the response map editor and go to the pattern page and try to make this change to accommodate version column being optional. It will help you learn how to use the response map editor. If you are not successful, we can then post a new map for you to take care of this scenario.

0 Likes 0 ·
KumarS avatar image KumarS KumarS commented ·

Attached is the one which takes care of optional column. But again I would advise you to do it yourself first and if you cannot figure out, then look at the solution. (This one assumes that version string is optional and is of the form alphabet followed by a digit.

 

 

0 Likes 0 ·
sittinun avatar image
sittinun answered sittinun posted
Thanks a lot PaulD. That's work.
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

PaulD avatar image
PaulD answered PaulD posted

This is a difficult one to map.  iTest's standard table mapper doesn't deal with tables when rows span more than one line.  As you've seen, you end up with an additional row in your table for the extra lines.

 

Another way to deal with this case is to use a pattern mapper, because your table is otherwise quite regular.  I'm attaching a response map that will pull out the various columns for you.  For the Port List column, it will extract the full field -- spanning additional rows as long as the following row starts with whitespace.

 

The next challenge is to remove the extra whitespace (including newline) from the port list for each row.  This is handled by adding a custom query that finds a port list for a given row (by row number) and then uses xpath's normalize-space function to replace all blocks of whitespace in the string with a single space.  This makes it all look pretty.  

 

Unfortunately, if you want to use the "clean" version of the port list items for each row, you will need to access it using a ports_by_row(row_number) query.  (You won't be able to use point-and-click analysis for this stuff, using the usual "blue boxes" in the response view.)

 

Let me know if you have questions.


10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.