2

I am trying to use SmartFormat and I have an issue with it. I am using the following format

"{SelectedUsers:| {User.FirstName} is selected for '{Job.Summary} job. ', }" and I am expecting that the output will be like following for each item. (If the first item in the collection has values 'Joe' as User.FirstName and 'witch hunting' as Job.Summary )

"Joe is selecting for 'witch hunting' job."

and so on display other items in the selected users collection. But the output is

{ User = { FirstName = Test }, Job = { Summary = Job Summary } }

I am not sure if my syntaxt is wrong or the given feature is not implemented in SmartFormat. Any help is much appreciated.

Ian Ringrose
  • 51,220
  • 55
  • 213
  • 317
adeel41
  • 3,123
  • 1
  • 29
  • 25

1 Answers1

2

Looks like your syntax is wrong. The List Formatting syntax is {[selector]:[itemFormat]|[spacer]|[finalSpacer]}, but your | looks to be in the wrong place.

This ought to work:

"{SelectedUsers:{User.FirstName} is selected for '{Job.Summary}' job|, |, and }."
//-collection--:---------- repeated for each item ------------------|-spacer-|-finalSpacer-}

This would output something like:

"Joe is selected for 'witch hunting' job, Scott is selected for 'cowboy' job, and Adeel is selected for 'programming' job."
Scott Rippey
  • 15,614
  • 5
  • 70
  • 85