Skip Navigation

[Resolved] new row with repeating field next value

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user had a table but wanted to display the repeated fields individually.

Solution:
Since this is a repeatable field then you should be able to show each individual field value by using the shortcode below.
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153482

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 2 voices.

Last updated by Tiit Sau 6 years ago.

Assisted by: Shane.

Author
Posts
#644034
repeting field values.png

How to generate new row for every value, if repeating field have more than 1 value? I hope the picture added explains, what i'm tryng to build. In first table i have repeating field values simply separated by comma, second table is just a drawing how i wish to look it like.

#644207

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Tiit,

Since this is a repeatable field then you should be able to show each individual field value by using the shortcode below.
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153482

Please let me know if this helps.
Thanks,
Shane

#644855

Hi Shane,

Thanks for quick response, but i do need some more guidance. About wpv-for-each i read a lot before asking help. Looks pretty clear how to get a list of repeating fields, but i have to build new table row repeating all other fields also. If you don't mind to give me a sample.
Here is my first attempt:

<wpv-loop>
		[wpv-for-each usermeta="car-plate-number"]
          		<tr>  
					<td>[wpv-user field="user_firstname"] [wpv-user field="user_lastname"]</td>
					<td>[types usermeta="car-plate-number"][/types]</td>
					<td>[types usermeta='drivers-license'][/types]</td>
          		</tr>
        	[/wpv-for-each]
</wpv-loop>
#645089

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Tiit,

Try this.

<wpv-loop>
        [wpv-for-each usermeta="wpcf-car-plate-number"]
                <tr>  
                    <td>[wpv-user field="user_firstname"] [wpv-user field="user_lastname"]</td>
                    <td>[types usermeta="car-plate-number"][/types]</td>
                    <td>[types usermeta='drivers-license'][/types]</td>
                </tr>
            [/wpv-for-each]
</wpv-loop>

This should start printing out the correct information now.

Thanks,
Shane

#645164
with-wpcf-prefix.png

I tried this way earlier today - prints out repeating fields into one cell.
Or is there a way to set wpv-conditional to check usermeta second value exist?

#645245

I found in other topic:
[wpv-for-each] loop shortcode iterate through multiple items in a post meta field ... means it only works in custom post fields, it does not work for custom user fields. https://toolset.com/forums/topic/usermeta-repeater-field/

If wpv-for-each still not extended for usermeta, let's try with wpv-conditional. I just can't find how to check the existence second value of repeated usermeta.

#645248

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Tiit,

There should be an index attribute.

You can try using index=0 or index=1 attribute to your types shortcode and see if that helps.

index=1 should be for the second item in the repeated fields.

Thanks,
Shane

#645353
solved.png

Here it is:

	<wpv-loop>
            <tr>  
              <td>[wpv-user field="user_firstname"]</td>
              <td>[types usermeta="car-plate-number" index="0"][/types]</td>
              <td>[types usermeta='drivers-license'][/types]</td>
             </tr>            
    		[wpv-conditional if="( '[types usermeta='car-plate-number' index='1'][/types]' ne '' )"]
                <tr>  
                    <td>[wpv-user field="user_firstname"]</td>
                    <td>[types usermeta="car-plate-number" index="1"][/types]</td>
                    <td>[types usermeta='drivers-license'][/types]</td>
                </tr>
            [/wpv-conditional]
	</wpv-loop>

Thanks Shane!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.