Deleting an express attribute programatically

Can anyone shed some light on how I might make it so a button within a block can delete an express attribute? I feel like it is something in the KeyHeader class but I can’t figure out how to make it work.
Thanks in advance.

Hi @Chrouglas

Just to confirm - are you talking about deleting the Express object’s attribute value or actually deleting an Express attribute from an Express object type? Maybe a few more details about your use case would be helpful.

I’m not sure if you’ve had a chance to review this page or if it has any useful info but this looks like the closest to the information you might be looking for: Programmatically Creating Express Objects :: Concrete CMS

Thanks for the response.

Yes indeed, I’ve checked that tutorial page a bunch. Lots about adding an attribute and nothing about deleting it.

And yes, I’d like to delete the actual attribute.

Here’s some more detail about what I am trying to build… its an attendance/attendees block that uses express. The package creates some basic attributes (first name, last name, active) upon installation. From the published attendees block, the user can fill in the info for those ‘columns’ and also add ‘rows’ for additional attendees. Additionally, they could add more columns if need be. The columns would of course be attributes added to the express entity and that is working fine. The problem I am having is ‘what if they want to delete a column’? I know it can be done in the dashboard but I am trying to have all this functionality right from the published block using ajax calls to create the new columns and would like to do the same to delete them. Any ideas?

Side note: do you think its a block(s) that anyone would even use? :slight_smile: I initially built this for my kid’s school club sport and made it so I could add the names and then stuff like photos of their membership cards, photos of their vax cards, their grade, a headshot, a check box for whether they submitted certain health forms, etc). But while setting it all up as a tinkering admin was pretty easy, making it an installable package is a bit harder… hence all the forum posts.

Anyway, let me know if you have any other questions.

Yeah I think that seems like a reasonably compelling use case.

Thanks for the background, that helps to give me a better picture of what you’re shooting for.

So this is how the dashboard does it:

Here’s the link to the method in the API docs:

Does that help get you closer to to what you’re looking for?