Can users add their own attributes to a business object

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ask180
Posts: 161
Joined: Thu Oct 04, 2012 11:40 pm

Can users add their own attributes to a business object

Post by ask180 »

Hi,
Let's say I have a Person business object that has Name, Gender and Age as its attributes.

The business wants to investigate these persons, and add their own data which arises from their investigation. And the data could be anything - nationality, hair colour, age of first born daughter, favourite donut variety etc. This makes it impossible to define attributes up front - there are millions of possible attributes.

So, I thought that maybe I hang a business object off Person, called Person Attributes - multiple allowed. One row for each attribute, with an unlimited number of rows possible for each person.

Sounds good. Except, how does the user search for persons. For example, I want to find all persons with a Name of 'John', and a Hair Colour of 'Black'? How can I do that, when I don't have an attribute of Hair Colour on Person.

Worse still, how do I do a search for all persons with a Name of 'John', a Hair Colour of 'Black', and an age of their first born daughter of 9?

Any thoughts?
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: Can users add their own attributes to a business object

Post by idpSteve »

I've come across this a bit, it's a limitation I agree.

Presumptively you could say:

FIND Person WHERE (Person.Name='John' AND EXISTS PersonAttribute WHERE (PersonAttribute.Label='Hair Color' AND PersonAttribute.Value='Black' AND PersonAttribute IN Person.Attribute))

The problem is one user will type 'Hair Color' into the label field, someone else will type in 'Hair Colour' etc.

You could make the Person searches dynamic using another search object, with a few label and value fields, but it's still a bit weird!

FIND Person WHERE (Person.Name=Object.PersonName AND EXISTS PersonAttribute WHERE (PersonAttribute.Label=Object.Label1 AND PersonAttribute.Value=Object.Value1 AND PersonAttribute IN Person.Attribute) AND EXISTS PersonAttribute WHERE (PersonAttribute.Label=Object.Label2 AND PersonAttribute.Value=Object.Value2 AND PersonAttribute IN Person.Attribute))

Not much valuable input here, sorry!
Jaymer
Posts: 2451
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Can users add their own attributes to a business object

Post by Jaymer »

If this is something that super important for your application, then sure, it can be done. But it’s not built-in to Aware . I wonder if it’s built-in to any other development systems or database tools. May be a No SQL tool.
I think it involves as you said, having a separate related table to hold many attributes. That’s kind a straightforward.
Then a system for allowing entering of attribute values.
This is a standard problem. I worked on the system 25 years ago using magic and btrieve where this was implemented. It’s a whole lot easier with the SQL.
It’s just a few hours of coming up with a Interface to allow the searching of the attributes and allowing the backend to crunch the data. Then browse the results.

What kind of equality conditions do you need to allow for.
Find all customers with hair color black?
Find all customers with hair black or Child equals Mary?
Find all customers with hair black or hair blue or child equals Marie?
Find all customers with hair black or child equals Marie and age between 20 and 30?

With and, or, not equal, parentheses, that’s going to get mighty tricky.
But if it’s just And or OR, I don’t think it’s any issue at all to do.

Also, for look and feel, I don’t think it’s anything that’s gonna work or integrate well with the kendo filter boxes, if you’re using those in your app.
You would have to have a preliminary screen that asked for these search values, then The sql will kick in, then you’ll get a results out, then you could do more kendo filter and sorting at that point.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply