delete data in aso cube - hyperion

I have been trying to delete data from aso application using maxl script, user wants data to be reloaded in 2015 again so I have been trying to delete it for only December month to see whether it works or not
alter database 'BFCVASOb'.'BFCVASOb' clear data in region '{[AOD 2015-12],[Measures]}';
I get this error:
dimension signature mismatch in function set constructor

You might try using CrossJoin to see if it works. Right now you are only clearing a very specific tuple of data (granted, it's a test):
alter database 'BFCVASOb'.'BFCVASOb' clear data in region 'CrossJoin({[AOD 2015-12]},{[Measures]})';

Related

How can I post updates for deleted records using TEMSDataSetResource in RAD Server 11

I have created a simple new Rad Server Package with resource with a data module to access a Firebird 3.05 database running on Ubuntu 18.0.4. I included sample endpoints and a database endpoint with one table from the database.
I modified the created FDQuery to return a subset of the records.
select * from EXPENSES where COMPANYID = :COMPANYID
It indicated the FireDACFBDriver was not found, and instead of adding the PhysFBDriverLink, I deleted the FireDACFBDriver in the project source and it asked to add back the FireDACIBDriver and it works. This is besides the point, I think, but just full disclosure. I have tried the PhysFBLink with same results, but have had trouble switching back and forth to Linux deploy, so this works for testing I believe.
The client app consists of a TEMSFireDACClient, a FDSchemaAdapter, FD TAble Adapter, FDMemTable and datasource and dbgrid and three buttons.
Button1
Expenses.GetEndpoint.Params.Clear()
expenses.GetEndpoint.Params.AddItem(
'CompanyID','10000080');
Expenses.GetData();
Button2
FDMemTable1.delete;
Button3
Expenses.GetEndpoint.Params.Clear();
expenses.GetEndpoint.Params.AddItem(
'CompanyID','10000080');
Expenses.PostUpdates;
Button One retrieves multiple rows, and button two deletes a row locally, and button 3 tries to apply the table updates back to the server.
When attempting to post updates. I get the following error:
EMS Error: Resource error. Request parameter not found: COMPANYID.
This works when the resource SQL is SELECT * FROM EXPENSES. Is it just that the TEMSDataSetResources can only work on the full table, or Is there something simple I am missing or a reference available for how to accomplish this?
I have tried creating a manual delete endpoint with:
delete from EXPENSES where EXPENSEID = #####
However, that is another post maybe if I have to go there. I cannot get around and error converting Unicode to integer variant when passing the parameter.

Delphi FireDAC: how to refresh data in cache

i need to refresh data in a TFDQuery which is in cached updates.
to simplify my problem, let's suppose my MsACCESS database is composed of 2 tables that i have to join.
LABTEST(id_test, dat_test, id_client, sample_typ)
SAMPLEType(id, SampleName)
in the Delphi application, i am using TFDConnection and 1 TFDQuery (in cached updates) in which i join the 2 tables which script is:
"SELECT T.id_test, T.dat_test, T.id_client, T.sample_typ, S.SampleName
FROM LABTEST T
left JOIN SAMPLEType S ON T.sample_typ = S.id"
in my application, i also use a DBGrid to show the result of the query.
and a button to edit the field "sample_typ", like this:
qr.Edit;
qr.FieldByName('sample_typ').AsString:=ce2.text;
qr.Post;
the edition of the 'sample_typ' field works fine but the corresponding 'sampleName' field is not changing (in the grid) after an update.
in fact it is not refreshed !
the problem is here: if i do refresh of the query, an exception is raised: "cannot refresh dataset. cached updates must be commited or canceled
and batch mode terminated before refreshing"
if i commit the updates, data will be sent to database and i don't want that, i need to keep the data in cache till the end of the operation.
also if i get out of the cache, data will be refreshed in the grid but will be sent to the database after qr.post and i don't want that.
i need to refresh data in the cache. what is the solution ?
Thanks in advance.
The issue comes down to the fact that you haven't told your UI that there is any dependency on the two fields - it clearly can't know how to do the join itself without resubmitting it so if you don't want to send the updates and reload you will have a problem.
It's not clear exactly what you are trying to do, but these two ideas may help you.
If you are not going to edit the fields in the SAMPLEType tables (S) then load the values from that table into a lookup table. You can load this into a TFDMemTable. You can use an adapter which loads from a query. Your UI controls can then show the value based on the valus looked up in your local TFDMemTable. Dependiong on the UI control this might be a 'LookupField' or some such.
You may also be able to store your main data in a TFDMemTable with an Adapter - you can specify diferent TFDCommands to read the whole recordset, refresh a record, update, insert and delete a record. The TFDCommands can act on multiple tables for joined recordsets like this. That would automatically refresh the individual record for you when you post it.

Retrieving history of tracked fields odoo 11

I want to know how to retrieve the history of tracked fields in odoo 11, so I can use them later for statistics and maybe use graphs to display some of its significant changes and such.
I know they get displayed in the chatter below the record and its related to mail.thread, but I don't know if there's a way to get those information for other manipulations, or where they're located in the database
Changes to tracked fields are stored in the mail.tracking.value model. You can review the table structure and methods in core/addons/mail/models/mail_tracking_value.py (in Odoo 11.0).
You can view the Messages directly to review some of the data by going to Settings > Technical > Email > Messages and filtering on Tracking values "is set".
The model is very basic, but you should be able to work with the message values to get your report/history data by sorting on the mail_message_id's date and time.

Fetching only changed SQL result from server

My iOS application fetches some photos, tags and comments from web server. I want it to fetch only changed or new added data. I don't want it to fetch repeated data again and again.
I use SDWebImage for pictures. But text are based on SQL text.
How could I understand the result of the SQL is changed or not? What kind of technique
should I use?
Is there a third party library for client side SQL catching?
I think it is not iOS related question technically. You should query always with the last queried timestamp.
Like:
SELECT * FROM comments WHERE last_modified > last_queried_timestamp;
last_modified field should store the timestamp of the last modification date or the timestamp of creation and the last_queried_timestamp parameter is the timestamp of the last date when you queried from the server.
This way you will not get twice the same changes.
(Unless you want it)

Updating core data performance

I'm creating an app that uses core data to store information from a web server. When there's an internet connection, the app will check if there are any changes in the entries and update them. Now, I'm wondering which is the best way to go about it. Each entry in my database has a last updated timestamp. Which of these 2 will be more efficient:
Go through all entries and check the timestamp to see which entry needs to be updated.
Delete the whole entity and re-download everything again.
Sorry if this seems like an obvious question and thanks!
I'd say option 1 would be most efficient, as there is rarely a case where downloading everything (especially in a large database with large amounts of data) is more efficient than only downloading the parts that you need.
I recently did something similiar.
I solve the problem, by assigning an unique ID and a global 'updated timestamp' and thinking about 'delta' change.
I explain better, I have a global 'latest update' variable stored in user preferences, with a default value of 01/01/2010.
This is roughly my JSON service:
response: {
metadata: {latestUpdate: 2013...ecc}
entities: {....}
}
Then, this is what's going on:
pass the 'latest update' to the web service and retrieve a list of entities
update the core data store
if everything went fine with core data, the 'latestUpdate' from the service metadata became my new 'latest update variable' stored in user preferences
That's it. I am only retrieving the needed change, and of course the web service is structured to deliver a proper list. Which is: a web service backed by a database, can deal with this matter quite well, and leave the iphone to be a 'simple client' only.
But I have to say that for small amount of data, it is still quite performant (and more bug free) to download the whole list at each request.
As per our discussion in the comments above, you can model your core data object entries with version control like this
CoreDataEntityPerson:
name : String
name_version : int
image : BinaryData
image_version : int
You can now model the server xml in the following way:
<person>
<name>michael</name>
<name_version>1</name_version>
<image>string_converted_imageData</image>
<image_version>1</image_version>
</person>
Now, you can follow the following steps :
When the response arrives and you parse it, you initially create a new object from entity and fill the data directly.
Next time, when you perform an update on the server, you increase the version count of an entry by 1 and store it.
E.g. lets say the name michael is now changed to abraham, then version count of name_version on server will be 2
This updated version count will come in the response data.
Now, while storing the data in the same object, if you find the version count to be same, then the data update of that entry can be skipped, but if you find the version count to be changed, then the update of that entry needs to be done.
This way you can efficiently perform check on each entry and perform updates only on the changed entries.
Advice:
The above approach works best when you're dealing with large amount of data updation.
In case of simple text entries for an object, simple overwrite of data on all entries is efficient enough. And this also keeps the data reponse model simple.

Resources