feat: run()をExport/Get分岐フロー化し処理時間計測(D4-D6)を追加
This commit is contained in:
parent
96133b8929
commit
2454478c65
@ -23,35 +23,61 @@ Sub run()
|
|||||||
'初期化処理
|
'初期化処理
|
||||||
Call init
|
Call init
|
||||||
|
|
||||||
|
defaultSh.Range("D4").Value = Now
|
||||||
defaultSh.Range("D3").Value = "取込処理中..."
|
defaultSh.Range("D3").Value = "取込処理中..."
|
||||||
Application.ScreenUpdating = False '画面更新停止
|
Application.ScreenUpdating = False '画面更新停止
|
||||||
Application.Calculation = xlManual '自動計算停止
|
Application.Calculation = xlManual '自動計算停止
|
||||||
'------------------------------------------
|
'------------------------------------------
|
||||||
Debug.Print "処理開始"
|
Debug.Print "処理開始"
|
||||||
|
|
||||||
'CSVデータ取得処理
|
Select Case fetchMethod
|
||||||
Dim resData As Variant
|
Case "Get"
|
||||||
|
Call runGetFlow
|
||||||
Debug.Print "データ取得処理開始"
|
Case Else
|
||||||
'テーブルのCSVデータ取得
|
Call runExportFlow
|
||||||
resData = exportCSVData(tableId)
|
End Select
|
||||||
|
|
||||||
'resDataが空の場合はスキップ
|
|
||||||
If IsEmpty(resData) Or resData = "" Then
|
|
||||||
Debug.Print "データが取得できませんでした"
|
|
||||||
Else
|
|
||||||
'CSVデータをシートに出力
|
|
||||||
Call exportCSVDataToSheet(resData, tableId)
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Debug.Print "処理終了"
|
Debug.Print "処理終了"
|
||||||
'------------------------------------------
|
'------------------------------------------
|
||||||
Application.Calculation = xlAutomatic '自動計算再開
|
Application.Calculation = xlAutomatic '自動計算再開
|
||||||
Application.ScreenUpdating = True '画面更新再開
|
Application.ScreenUpdating = True '画面更新再開
|
||||||
|
defaultSh.Range("D5").Value = Now
|
||||||
|
defaultSh.Range("D6").Value = (defaultSh.Range("D5").Value - defaultSh.Range("D4").Value) * 86400
|
||||||
defaultSh.Range("D3").Value = "取込処理完了"
|
defaultSh.Range("D3").Value = "取込処理完了"
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'******************************************************************************
|
||||||
|
'Export方式(CSV全件取得)でのデータ取込処理
|
||||||
|
Sub runExportFlow()
|
||||||
|
Dim resData As Variant
|
||||||
|
|
||||||
|
Debug.Print "データ取得処理開始(Export方式)"
|
||||||
|
resData = exportCSVData(tableId)
|
||||||
|
|
||||||
|
If IsEmpty(resData) Or resData = "" Then
|
||||||
|
Debug.Print "データが取得できませんでした"
|
||||||
|
Else
|
||||||
|
Call exportCSVDataToSheet(resData, tableId)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'******************************************************************************
|
||||||
|
'Get方式(api-record-get-multi)でのデータ取込処理
|
||||||
|
Sub runGetFlow()
|
||||||
|
Dim records As Collection
|
||||||
|
|
||||||
|
Debug.Print "データ取得処理開始(Get方式)"
|
||||||
|
Set records = getRecordsData(tableId)
|
||||||
|
|
||||||
|
If records Is Nothing Then
|
||||||
|
Debug.Print "データが取得できませんでした"
|
||||||
|
ElseIf records.count = 0 Then
|
||||||
|
Debug.Print "データが取得できませんでした"
|
||||||
|
Else
|
||||||
|
Call getRecordsDataToSheet(records, tableId)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
'******************************************************************************
|
'******************************************************************************
|
||||||
'CSVデータを取得
|
'CSVデータを取得
|
||||||
Function exportCSVData(tableId As String) As Variant
|
Function exportCSVData(tableId As String) As Variant
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user