Here's what I want to accomplish:
I have a BO that can calculate the cost of a part that we manufacture in our shop, based on how any parts are being produced in the production run. It basically amortizes the setup time across the number the number of parts being produced. So, the more parts you make, the production cost goes down.
So, I want to create a cursor with each row showing the cost for various production quantities... 1, 5, 20, 50, 100, etc. I will then display that cursor in a grid.
To create the rows, I will use a loop to drive the BO by changing its QTY value calling the CalculateCost() method which will set various properties for cost on the BO for labor and material. I will then dump those values to a new row in the cursor and continue the loop, populating the cursor.
The main point here is that I do not want to manually code the cursor schema. I want to build the cursor (schema) dynamically from the object properties. This will be a more flexible solutions.
You can do that but you have to iterate over the oject members with AMembers and the CREATECURSOR() for each of the fields. Pretty easy to do.
Question is why would you need a cursor if you already have an object with those properties?
+++ Rick ---
Let's say I have created a simple object from Empty, and that I have added sevaral properties (and values) to it. The properties could be Integers, floats, dates, strings, logicals, etc.
Now I want to create a cursor with fields named the same as the properties, and have 1 row in the cursor where the row has the values from the object properties.
Basically, I want a function like this:
CreateCursorFromObject(oMyObject, cCursor)