How do I convert a uobject pointer to a normal local variable?

I’m building a database plugin in which I have a query object that has a model object as a property. The model object property has an array of column objects in it. You can think of the model as a database table row.

Query->QueryModel->ModelColumns

I want a GetQueryResults(QueryObject) function to return an array of models(aka rows).

I’m stuck at trying to create new model object with it’s columns and properties attached. NewObject() and ConstructObject() seem to only be able to create a new empty Model.

The new model object has to be created exactly like the Query->QueryModel. I cant just create a new model and assign the columns to the Query->QueryModel->ModelColumns, because then all the models just point to the same columns.

Any code example would be a GREAT help. I’ve been stuck on this for 2 days now.

This is what i was looking for:

UDatabaseCommunicatorModel* Model = Cast(Query->QueryModel);

Normal C++ casting doesnt work on UObjects