Updating Aggregates

Updating Aggregates

  

Hi Guys,

I'm having a problem with updating an aggregate - the solution has something to do with linking my primary identifier across multiple web screens but I can't figure out how to do it.


Essentially, I have one web screen where a user will input details into a form and submit them, the submit button screen action creates a new entry in my aggregate. I then go to the next screen and input some additional details and submit them, with the submit screen action being create/update the aggregate. My problem is that the create/update function does not update the record created on the previous page, but rather the first record in the aggregate table.


I guess there is a simple way to specify which record you want to update, but I've been unable to figure it out so far.


Please could you let me know if you have any ideas?


Thanks!

Hi Joseph, 

You can specify the record to be updated by using the id of the recently created record. The action CreateOrUpdate returns the Id.

(something like this)


If you prefer, share you .oml with me and I can guide you through the implementation.

cheers,
Vera


Also Joseph, you should use the right terminology to avoid confusion. An aggregate is a query-like widget to query data with, an entity is a database table that holds data.

Thank you for the responses guys.

I've uploaded a test .oml that acts in the same way as my main one.

If you launch the site and input more than one set of details, then the entity will be updated but with some information going to one row and some information to another row for what should be the same ID.

Please would someone be able to explain how I link the ID to this as I am still struggling to make it work!


Thank you.

Hi Jospeph,

I took a look at the example eSpace, but I really don't see what you are trying to do here. I'd advise you to go over the logic, debug where necessary and try to find out what it is that makes it not work. For starters, I can't see any Id being passed from screen to screen, and the queries in the Preperations are all the same, without filter?

Thanks for the response Kilian - I have gone over the logic as you suggested and updated. 


With my current eSpace, after I create the record and move on to the next screen and try to update the record, I receive the error "DBO.[OSUSR_HWY_RECORDS] with key 0 was not updated". I can see that the ID is not passing between the screens correctly but can't see the reason why.


In terms of the preparations - I have set the records.ID = recordID , but I'm unsure if this needs to be in every preparation, or if there are other filters that are required?


Thank you!

Solution

Hi Joseph,

In the "A" and "B" actions of the HomePage screen, you pass the local variable (well, it's an input variable, but since the home screen is the starting screen, it should be a local variable) RecordID to the A and B screens. But that isn't filled at all! You should pass the output Id of the Create action instead:

Please take a moment to think why this is, and why your approach doesn't work! It feels like you're not at all comfortable with programming, and you're just doing something in a trial/error-based fashion. That won't take you far!



Solution

Thank you Kilian - you're correct I am just beginning to learn. 


I understand what was wrong before and how the logic should actually be implemented. 


Thanks for your help everyone.