How to show data of user that flagged a content(5 flag types or more)? This is a followup question about this Old question
I have 5 flag types for a content type. consider we have 5 flag types and we don't know how many flags our user used. I mean, the first user can flag a content by flag type 1, type 2 and type 5, and other user can flag same content by flag type 2 and type 4, and etc, OK?
I want to show a list of users that flagged same content, some users can use all flag types and others can use some flag types. thus I don't know users will use what flag types. You consider moreover &quot;username&quot;, I want to show user's &quot;E-mail&quot;. thus in this table I want to show &quot;username&quot;, user's &quot;E-mail&quot; and &quot;flag fields&quot;.
In below picture, I showed that a content can has different value. because any user can input different value in flag field. this table will appear in content page. I mean any content page has its specific table.

UPDATE
Now I have a new Idea that I would explain.
I can use Global custom text field. Consider I have 5 flag types, I added my 5 flag types username fields and hide them in views(exclude from display). As you know, First I should add flag types in Relationship part of views. when I add a username field, I should choose relationship in username field. Thus I should add 5 username fields.
After that I can use REPLACEMENT PATTERNS in &quot;global custom text&quot;. Now I have 5 patterns for my 5 username fields. Now I have a problem.
Consider when one user use 3 flag types(3 of 5 flag types that I enabled for specific content), I mean when he(she) flag(s) a specific content by 3 flag types, in custom text field we can see username that repeated 3 times, because we use all 5 PATTERNS of username fields in global custom text field.
How can I solve this problem?
Is there any HTML code to show one of these patterns?
Also I can use global PHP. Is there any PHP code for this problem?
alternatives welcome also
As per the "alternatives welcome also" in your question, I would format/present the data in your table in a different format/layout. which will make the data shown in it way more easy to digest/understand.

Have a look at this alternative, which shows the same data (to which I added a few more similar sample rows to illustrate what I mean):

---------------------------------------------------------------------
| User   | Email       | Flag A | Flag B | Flag C | Flag D | Flag E |
---------------------------------------------------------------------
| John   | John@a.com  | 4333   |        |        |        |        |
---------------------------------------------------------------------
| Jack   | Jack@b.com  | 9000   |        |        | 1390   | 7677   |
---------------------------------------------------------------------
| Hamed  | Hamed@c.com | 0123   | 0456   | 0789   |        |        |
---------------------------------------------------------------------
| Niall  | Niall@d.com |        | 3377   |        | 5566   |        |
---------------------------------------------------------------------


If you agree, note however that creating such table is not obvious if you're trying to do so with the Views module. However, using the Forena module (disclosure: I'm a co-maintainer), creating such table is straight forward: it's what is called a Crosstab table. This is a table with a special layout. It is formatted as a grid, with:


the rows representing one or more (combinations of) facts, such as countries or regions, names of persons (or users) like employees / salespeople (or user IDs / user names), names of Models, etc.
the columns representing one or more other facts, such as periods (months of a year, years, etc), available types/flavors of something (like types of errors), etc.
the intersections of rows and columns containing the actual information (data), such as summarized information (counts of something), timestamps, etc. and which might (optionally) include a hyperlink to a drill-down report.


For more info on this, have a look at the "Northwind database" demo videos, i.e:


How to create a report/graph about Shipping summary (fast forward to about 4:15 if you're not interested in the SQL query prototyping part of it).
How to create Crosstab Tables and (related) charts (fast forward to about 2:15 if you're not interested in the SQL query prototyping part of it).


To create such table for each "content page" (as in your question), you can use an appropriate Report parameter, which is like the equivalent of a Contextual filter. In your case, the node's id (= nid) would probably be a good candidate for such parameter. Have a look at this example report, and note the query string (= state=OH) in its URL. Just change that string to, eg,state=IL (or select some other value for state in the Parameters form) to get the basic idea about such parameter. Refer to the tutorial about Forena report parameters for more details about this topic.

This technique can also be applied to any of your entities you want to create reports about (nodes, users, whatever). For example, after you enabled Forena in your own site, you'll have access to one of its sample reports (= Active users), located at /reports/drupaladmin.active_users. If you then follow the link "logs" in that report for any of the users in the report (say with user name = SomeUserName), you'll get the (log) details about that user, via an URL similar to /reports/drupaladmin.user_logs?name=SomeUserName. So in this case the user name is used as such report parameter also.