Subject Re: Array
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Mon, 8 Mar 2021 15:31:27 +0530
Newsgroups dbase.getting-started

On 08.03.2021 12:54, Rob Rickard wrote:
> Hi All
> can somebody please advise which is the best solution to use.
> Append from array OR extract out of a txt file.
> i need to get information out of this array
>
> [{"Id":2773,"Date":"2021-03-08T00:00:00+11:00","StartTime":1615147200,"EndTime":1615183200,"Mealbreak":"2021-03-08T00:30:00+11:00","Slots":[{"blnEmptySlot":false,"strType":"B","intStart":0,"intEnd":1800,"intUnixStart":1615147200,"intUnixEnd":1615149000,"mixedActivity":{"intState":3,"blnCanStartEarly":1,"blnCanEndEarly":1,"blnIsMandatory":1,"strBreakType":"M"},"strTypeName":"Echo","strState":"Scheduled Duration"}],"TotalTime":9.5,"Cost":0,"OperationalUnit":21,"Employee":0,"Comment":"Note: All shift Finish times are nominal and should not be viewed as an expected finish time. For all entitlements please refer to the EBA","Warning":"","WarningOverrideComment":"","Published":false,"MatchedByTimesheet":0,"Open":false,"ApprovalRequired":false,"ConfirmStatus":0,"ConfirmComment":"","ConfirmBy":0,"ConfirmTime":0,"SwapStatus":0,"SwapManageBy":null,"ShiftTemplate":1,"ConnectStatus":null,"Creator":1,"Created":"2021-03-04T10:29:28+11:00","Modified":"2021-03-04T10:30:21+11:00","OnCost":0,"StartTimeLocalized":"2021-03-08T07:00:00+11:00","EndTimeLocalized":"2021-03-08T17:00:00+11:00","ExternalId":null,"ConnectCreator":null,"BidsCount":null},{"Id":2774,"Date":"2021-03-08T00:00:00+11:00","StartTime":1615147200,"EndTime":1615183200,"Mealbreak":"2021-03-08T00:30:00+11:00","Slots":[{"blnEmptySlot":false,"strType":"B","intStart":0,"intEnd":1800,"intUnixStart":1615147200,"intUnixEnd":1615149000,"mixedActivity":{"intState":3,"blnCanStartEarly":1,"blnCanEndEarly":1,"blnIsMandatory":1,"strBreakType":"M"},"strTypeName":"Echo","strState":"Scheduled Duration"}],"TotalTime":9.5,"Cost":0,"OperationalUnit":44,"Employee":0,"Comment":"Note: All shift Finish times are nominal and should not be viewed as an expected finish time. For all entitlements please refer to the EBA","Warning":"","WarningOverrideComment":"","Published":false,"MatchedByTimesheet":0,"Open":false,"ApprovalRequired":false,"ConfirmStatus":0,"ConfirmComment":"","ConfirmBy":0,"ConfirmTime":0,"SwapStatus":0,"SwapManageBy":null,"ShiftTemplate":1,"ConnectStatus":null,"Creator":1,"Created":"2021-03-04T10:30:27+11:00","Modified":"2021-03-04T10:30:57+11:00","OnCost":0,"StartTimeLocalized":"2021-03-08T07:00:00+11:00","EndTimeLocalized":"2021-03-08T17:00:00+11:00","ExternalId":null,"ConnectCreator":null,"BidsCount":null},{"Id":2775,"
>
> i have included the start of the 2nd shift - there are multiple shifts to deal with
> i do not need all the information only parts of it. eg Id, Date, starttime, finishtime, Employee
> i have never done anything with append from array so any help and suggestions would be greatly appreciated. i have saved the output to a txt file with no problems.so ....

Good Evening Rob,
It seems to be some sort of a txt log.
I have also not used append from array.
But I have used
append from attendance.csv delimited with ","

after processing the log file in dbase and store the required columns in
attendance.csv

My recommendation (wait for recommendation of others also)
1. Process the source file in dbase and store the required columns in
another txt file. Thing to watch for is use of tab (chr 9) as separtor
or just chr 10 only as line feed. Windows uses chr 10 + chr 13 combo as
new line character but not all systems follow this. So view the file in
hex editor to verify the absence of non visible characters in the source
file.

2. Import into a temp dbf file. The number of columns and data types
should match. Special care would be rquired in date handling. Since you
will be processing the file before hand you can set the date format that
suits your system. I would recommend going through the thread "date
problem in appending from excel" it is not old just 2 or 3 threads below
this thread.

3. Verify the data and then append to final dbf. Once you achieve the
required settings you may want to skip temp dbf file. It is your choice.

Regards
Akshat