cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Temporal Data: no data shown

former_member729305
Participant
0 Likes
807

Dear all,

we want to make the data within our CAP app temporal.

first we import the temporal aspect into our schema and add the temporal aspect to our entity.

additionally the ValidFrom value has been added to uploaded csv files for our entity.

Once this is done the list report view does not show any entry any more.

using {
 cuid,
 managed,
 temporal
} from '@sap/cds/common';
namespace test;
entity Books : cuid, managed, temporal {
 title : String;
 stock : Integer
} 

Does anyone know why this occures respecitvely which step is missing?

capire - Temporal Data (cloud.sap)

Best Regards

Max

View Entire Topic
martinstenzig
Contributor
0 Likes

Max, I don't think you are missing anything. When you add the temporal aspect, the system adds valid from to the Primary Key of the table. You can validate that by running 'cds compile ./db/[schema_name].cds --to sql'

At present there is no standard handler to automatically populate validFrom and validTo. Have a look at this thread CAP Temporal Data with NodeJS

I would also be interested to hear what standard behavior you would expect.

former_member729305
Participant
0 Likes

Hi martin.stenzig3

thanks for the quick response! I understand and I agree. But how would I upload records to that data format for column ValidFrom (within my csv file)?

format like e.g. 2021-04-06T10:00:00Z still returns empty in my list report view.

Best Regards

Max

TobiT
Participant

Hi Martin,

i would expect the service to return all entries valid as of now (entries with empty validTo). If i understand the cap documentation correctly this should be the case:

As-of-now Queries

READ requests without specifying any temporal query parameter will automatically return data valid as of now.

GET Employees?
$expand=jobs($select=role&$expand=dept($select=name))

Source: https://cap.cloud.sap/docs/guides/temporal-data

Do i understand this correctly?

martinstenzig
Contributor
0 Likes

I agree with you that an empty validTo should be defaulted to something far, far in the future, but that's not happening as of today.