open-insight/LSL2/OIEVENT/CREATE/REACT_LL_SERV..json
2024-03-25 15:12:53 -07:00

11 lines
2.3 KiB
JSON

{
"header": {
"version": 1,
"type": "record"
},
"body": {
"record1": {
"<1>": "declare function msg, send_event, admin_user, center_window, xlate, memberof, set_property\r\ndeclare function send_message, post_event, fieldcount\r\ndeclare subroutine end_dialog\r\n\r\n$insert msg_equates\r\n$insert react_ll_serv_equ\r\n$insert logical\r\ndeclare subroutine array_sort\r\n\r\nif index( CreateParam, 'CENTER', 1 ) then\r\n void = center_window( @window )\r\nend else\r\n Void = set_property( @window, 'VISIBLE', 1 )\r\nend\r\n\r\nopen 'CONFIG' to ConfigTable else\r\n Void = msg( '', 'Unable to open CONFIG table' )\r\n end_dialog( @window, '' )\r\n return 0\r\nend\r\nread ReactLLInfo from ConfigTable, 'REACT_LL_SERV' then\r\n if ReactLLInfo <> '' then\r\n\t Reactors = ReactLLInfo<LLReactor$>\r\n\t LastDate = ReactLLInfo<LLLastDate$>\r\n\t LastTime = REactLLInfo<LLLastTime$>\r\n\t LogIDs = ReactLLInfo<LLLogID$>\r\n\t HrsSinceLast = '' ;* IS AN EQUATE IN THE REACT_LL_SERV AS LLHrsSinceLast$ BUT NOT PHYSICALLY STORED\r\n\t \r\n * Loop through each reactor and calculate the hours\r\n \r\n Today = date()\r\n\t Rcnt = fieldcount( Reactors, @vm )\r\n\t for i = 1 to Rcnt\r\n DateDiff = Today - LastDate<1,i>\r\n SecondsToAdd = 0\r\n if DateDiff then\r\n SecondsToAdd = 86400*DateDiff\r\n end\r\n Tans = ( time() + SecondsToAdd ) - LastTime<1,i>\r\n HrsSinceLast<1,i> = ( Tans /3600) * 100\t \r\n\t next i\r\n\t HrsSinceLast = oconv( HrsSinceLast, 'MD2' )\r\n\t LastDate = oconv( LastDate, 'D2/' )\r\n\t LastTime = oconv( LastTime, 'MTH' )\r\n\t \r\n * NEED TO SORT BY DSND HOURS\r\n ArraysToPass = HrsSinceLast:@fm:Reactors:@fm:LastDate:@fm:LastTime:@fm:LogIDs\r\n \r\n array_sort( ArraysToPass, 'D', 'R' )\t\t;* WTFITS???????\r\n \r\n NewArray = ''\r\n HoldHrs = ArraysToPass<1>\r\n NewArray<5> = ArraysToPass<1>\r\n NewArray<4> = ArraysToPass<5>\r\n NewArray<3> = ArraysToPass<4>\r\n NewArray<2> = ArraysToPass<3>\r\n NewArray<1> = ArraysToPass<2>\r\n .ll_info->array = NewArray\r\n end\r\nend\r\nRETURN 1"
}
}
}