Multiple services from custom array

Can someone give me some pointers to creating multiple service checks for a host based on a custom array added to a host or service template? I’ve read through a number of examples and forum posts but can’t quite get a handle on the process.

Basically I want to be able to specify an array of values, and for each value in the array - a service check gets created on that host.

Getting the custom data field created and assigned to a host or service template seems fairly straightforward but I’m struggling with the apply rules required (or at least I think I need apply rules).

Also, how do I modify the service check command to reference the variable? Will the variable name remain static, or how do I reference N elements of an array.

Essentially, if I have an array:

Value1
Value2
Value3

Would I use;

command -arg $Value$

somehow, or would it be something like

command -arg $Value.N$

How do I access or know how many of N there are? I’m a bit lost here so any help gratefully received thanks.