Custom table macro field

Dennis Hulsmans asked on May 4, 2017 15:23

Hi

I wonder if it's possible to have a custom table field to have a default value with a macro (get values from other custom table fields)?

We have a column which will contain a part of a resourcestring. The default value would contain for example Name + Type from the other custom table fields.

KR,
D.

Recent Answers


Rui Wang answered on May 4, 2017 16:54

I think it depends on the time sequence of which field gets populated first. If the other field is not populated before the macro is been evaluated, then you won't get any data.

I worked with similar case before, e.g. there is a username field, and it should be combined with data from first and last name field automatically. We end up writing a custom method using event handler to populate that field upon save/update.

1 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on May 4, 2017 19:03

On top of what Rui was saying, I guess you can but it depends on you are going to add items to your table as well. If you do it via Kentico admin interface - no problem, if you do it in a custom code - you probably have to call marcoresolver. In SQL - you have to create CLR procedure and resolve macro in there (kinda overkill)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.