What do you want your custom property to be specifically?
Do you want it be in the same format as the key prop? If so you can bind your key prop to some custom property elsewhere.
The name of that key comes from the binding you have set. Whenever the binding updates, the names will go back to AMT and ITEM_ID (I'm guessing the column names in the database). You can't really change them by just clicking on them. You could change them with a script transform. What does your binding look like?
return [
{
"amount": row["AMT"]
"itemId": row["ITEM_ID"]
}
for row in value
]
Or, imperatively, if that's more readable than a list comprehension:
ret = []
for row in value:
ret.append({
"amount": row["AMT"]
"itemId": row["ITEM_ID"]
})
return ret
However, if you just need to rename columns, then I would recommend using aliases in your query; transforms are significantly more "expensive" in terms of performance than directly returning the data in the format you want in the first place.
Let's take a step back, lest we go down an XY problem rabbit hole.
You've got one outer SQL query returning a list of items.
You want to do some calculations on these items.
Then, at some point, you want to issue additional queries?
Can you more clearly outline what the flow of data is here? What are operators/end users doing to trigger a query to run, or, if they aren't, can this calculation happen entirely outside of Perspective?
I am using the custom properties as placeholders until the operator gets the work order/run set the way they want it. I am building a query to send back to the database.
When the operator is ready, I would like to send the custom properties to a SQL database. (Probably off of a push button or something not automatically.)
I suppose these calculations could happen outside of perspective, but I think there will always be a need to edit or change something.
Flow of data is SQL to Tables, to Custom Properties, and back to SQL if possible.
I would say you're totally fine to 'stage' values in custom properties.
When you're ready to insert the data, I would at minimum have a named query to handle the actual data insert. You could also write a project library script (e.g. dataEntry with some function enterOperatorData) that's as "pure" as possible - it accepts whatever parameters you have to store, and sends them into the database. That way you're separating the data entry process (as far as DB logic) from any logic in your Perspective screen, making it easier to change one or the other independently.
The network traffic to the DB is basically the same, but the database will 'hold' all the records until the transaction is finalized, at which point it can update indices/insert the actual data into storage in one operation.
What Paul said, but also consider dynamically constructing "Prep" inserts with multiple VALUES elements. JDBC allows 4k "?" parameters at a time, IIRC. This reduces the number of DB round trips.