question

simhan_krr avatar image
simhan_krr asked Spirent_Admin edited

Table Response Map - with some empty col

 

I'm working with different table outputs that will contain empty elements in any of the columns. I want to have a generic response map (using delimiter and not column width) to parse any such table with different number of columns in each of the tables. Could someone help me out. 

 

E.g:

 

 1) 

 

IP         port  tag        status

----------------------------------------

1.1.1.1  80                UP

1.1.1.2  80    v1         UP 

 

 

 

2)

 

Name         ID       key     time     group  status

----------------------------------------------------------------------

user1         user1  1234   12:45              ONLINE

user2         user2  1235               G1      ONLINE

 

 

 

 

iTestresponse mappattern maptable 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.

1 Answer

·
KumarS avatar image
KumarS answered KumarS posted

Using a delimiter will give you incorrect results because your delimiter here is 'space' and it is ambiguous which column values align to which column if you want to split your row using 'spaces'. I would suggest using column width for this response unless you know for sure that column width is not going to work well for this response (e.g. column values overflow into another column). Even in those cases, I think there options on columns in the table map which allow you to define the column parsing in such a way that one can "steal" characters from the next column.

 

If all table mapping options fail, you can finally use "pattern map" to define a custom regex which can account for appropriate columns being missing (but in my personal opinion, those are harder regexes to write). So I would give table mapping with fixed width a try first and see if it works for you.

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.

ramarb avatar image ramarb commented ·

Column width works fine for this sample. I have a query: Defining column width based on header makes sense or based on relative column values?

I have tried with many samples by tailoring the response; sometimes, it cuts the value.

Hence, column width demarcation plays a vital role in these kind of responses!

0 Likes 0 ·
KumarS avatar image KumarS ramarb commented ·
My recommendation will be to look at the column values to determine/define column widths. Header names may be smaller or larger than column value widths. You can always name your columns properly in the table map if the automatic column naming algorithm does not name the columns properly.
0 Likes 0 ·

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.