I suggest to add 2 things
1 - the description of the bakupHistory.json file
1.1 - main structure, an object with the successive paths of the database path as properties:
{dataBasePathOLD
[
{backupObj}
...
{backupObj}
]
{dataBasePathNEW
[
{backupObj}
...
{backupObj}
]
}
1.2 - the backup object structure
attachments: collection of objects {attachmentPath : text ; found : boolean}
backupNumber: integer
backupPath: text
datapat: text
duration: integer
endingDate: timestamp
logPath: text
scheduledDate: timestamp
startingDate: timestamp
status: integer
2 - an example of code to read something in the file:
++++++++++++++++
//lastBackupDescription_srv -> ojb
//returns an object, description of the last backup
//⚠️ execute on server method
DECLARE->$out_o : Object
var $o : Object
var $backupHistory_o : Object
var $DBbackup_c : Collection
var $backupHistory_t : Text
var $json_t : Text
var $DBpath_t : Text
var $i_l : Integer
$out_o:=New object()
If (Application type=4D Remote mode)
$out_o.error:=Current method name+" not on 4D Remote"
Else
$o:=File(Backup history file)
If ($o=Null)
$out_o.error:=Current method name+" backup history file not found"
Else
$backupHistory_t:=$o.platformPath
$json_t:=Document to text($backupHistory_t)
$backupHistory_o:=JSON Parse($json_t)
$DBpath_t:=Structure file //⚠️ must be executed by the "database engine", not on client
ARRAY TEXT($prop_at; 0x0000)
OB GET PROPERTY NAMES($backupHistory_o; $DBpath_at)
$i_l:=Find in array($DBpath_at; $DBpath_t)
If ($i_l<1)
$out_o.error:=Current method name+" no backups found for database "+$DBpath_t
Else
$DBbackup_c:=$backupHistory_o[$DBpath_t] //database backups under the actual database path
$out_o:=$DBbackup_c[$DBbackup_c.length-1] //last backup
End if
End if
End if
++++++++++++++++
I suggest to add 2 things 1 - the description of the bakupHistory.json file 1.1 - main structure, an object with the successive paths of the database path as properties: {dataBasePathOLD [ {backupObj} ... {backupObj} ] {dataBasePathNEW [ {backupObj} ... {backupObj} ] } 1.2 - the backup object structure attachments: collection of objects {attachmentPath : text ; found : boolean} backupNumber: integer backupPath: text datapat: text duration: integer endingDate: timestamp logPath: text scheduledDate: timestamp startingDate: timestamp status: integer
2 - an example of code to read something in the file: ++++++++++++++++ //lastBackupDescription_srv -> ojb //returns an object, description of the last backup //⚠️ execute on server method
DECLARE->$out_o : Object
var $o : Object var $backupHistory_o : Object var $DBbackup_c : Collection var $backupHistory_t : Text var $json_t : Text var $DBpath_t : Text var $i_l : Integer
$out_o:=New object() If (Application type=4D Remote mode) $out_o.error:=Current method name+" not on 4D Remote" Else $o:=File(Backup history file) If ($o=Null) $out_o.error:=Current method name+" backup history file not found" Else $backupHistory_t:=$o.platformPath $json_t:=Document to text($backupHistory_t) $backupHistory_o:=JSON Parse($json_t) $DBpath_t:=Structure file //⚠️ must be executed by the "database engine", not on client ARRAY TEXT($prop_at; 0x0000) OB GET PROPERTY NAMES($backupHistory_o; $DBpath_at) $i_l:=Find in array($DBpath_at; $DBpath_t) If ($i_l<1) $out_o.error:=Current method name+" no backups found for database "+$DBpath_t Else $DBbackup_c:=$backupHistory_o[$DBpath_t] //database backups under the actual database path $out_o:=$DBbackup_c[$DBbackup_c.length-1] //last backup End if End if End if ++++++++++++++++