Can you use a 'dynamic' property name to access data from a server repeat?

As the title suggests, i’m trying to test some functionality before building a database import function that relies in the user mapping the fields in the uploaded CSV file to the columns in the relevant database table.

In this test case i have a repeat on the imported CSV file:

image

Usually I could test something by simply outputting a Value and using one of the properties in the repeat data, in this case the data relatinging to the property ‘date’ will be outputted:

image

My questions is though, can I output that same ‘date’ data, but be able to provide the property to output dynamically via other data in the server action:

Such as this:

Naturally the above code simply returns the word “date” that it’s getting from a datasource earlier in the server action. But i want to use that text ‘date’ but in reference to the column to return from the repeat data.

Does this make sense? And can it be done?

Thanks

{{value['date']}}

You can inject the variable inside the square brackets. In the example above I injected a literal string, hence it’s surrounded by ''. value is a variable set by the Repeat step containing the object of the current iteration, as shown in the Data Binding Picker when modifying the Set Value’s expression

1 Like

Thanks for responding. I’m probably missing something, I’m trying what you have noted, using the dynamic value like below, but it’s not even outputting the value ‘tsteingDynamicValue’

Result in dev console:

{
	"repeat": [
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		},
		{
			"dynamicValue": "date",
			"hardCodedValue": "3/06/2021"
		}
	]
}

My mistake, it’s $value instead of value

1 Like

Yes, i just worked that out. Thanks!

This is just what i needed. Much appreciated @Apple

1 Like