Battling with NullIdentifier()

Version 11.6.32 build 13558


I’m creating a simple Table with List and Edit Details for an entity called Levels


It works off this entity Levels. I’m using a Database Table with a Long Integer Id – with AutoNumber = Yes

 

I click on the Add Level button to add my first Level into the table.

The OnSaveClick Action calls a Server side to to a CreateOrUpdate

I then use a Server Side Action called SS_CreateOrUpdateLevels and pass in LevelId = If(GetLevelById.List.Current.Levels.Id=0,NullIdentifier(),GetLevelById.List.Current.Levels.Id) which would be set it to value = NullIdentifier() (In the Debug it shows 0)

Using the CreateOrUpdateLevels Action here


Am I wrong in assuming that the CreateOrUpdateLevel action on the Database table is not working? 

Because if it’s not found (or converting NullIdentifier to 0)  it is supposed to create the record? What am I doing wrong? Help!! Newbie.

Hi,

The SS_CreateOrUpdateLevels should receive a Level Record and not a LevelId. If the LevelId of that record is Null a new record will be created if there is a LevelId that record will be updated. What are you passing to the entity action CreateOrUpdateLevels?

Did you went through the training? in this path if you follow all the videos from the Basic Screen Development I you will understand how this should be done.

Regards,

Marcelo

Hi,

Modify your SS_CreateOrUpdateLevels action:

And make your input parameter data type Level, not Level identifier, because you will lose description.

Thanks you both. Appreciate your help. I will revisit the training again. I am trying to use the CreateOrUpdate to avoid the double separate actions of Create and Update. :-)

Hi! You can also "scaffold" an entity to the a test flow and analyze how it was been done. 

Giving special attention to the types from all the variables involved. 

Regards

Graça


Maria da Graça Peixoto wrote:

Hi! You can also "scaffold" an entity to the a test flow and analyze how it was been done. 

Giving special attention to the types from all the variables involved. 

Regards

Graça


Hi Maria, Not quite sure what you mean? please go into a bit more detail. Thanks


Solution

Let me see what can I do as a comics builder: 

Flow to test 

"scaffold" the entity

Result

When they call the detail screen the to add a record the Id  sent is nullidentifier()

What goes to the EntityAnyCreateOrUpdate is a variable type "EntityAny"  and the Id is (as you can see by the symbol ) a type EntityAny identifier.


and you continue analyzing what have been done, compare with you work. 

Regards

Graça

Solution

Thank you all for your input. All were useful and helpful :-)