Парсинг всех QVD для быстрого поиска поля по значению
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
//Загрузка списка файлов из директории. Загрузка данных из этих файлов SET directoryName = 'C:\QVDStorage\RawData\'; //Получение названия файлов FOR each fileName in FileList('$(directoryName)*.qvd') FileList: Load '$(directoryName)' as [DirectoryName], mid('$(fileName)',len('$(directoryName)')+1) as [FileName] Autogenerate(1) ; NEXT fileName //Получение названия полей во всех QVD FOR i=1 to NoOfRows('FileList') LET vQVDName = Peek('FileName',$(i)-1,'FileList'); TEMP: FIRST 1 LOAD * FROM '$(directoryName)$(vQVDName)'(qvd); FOR vColumnCounter = 1 TO NoOfFields('TEMP') LET vFieldName = FieldName(vColumnCounter, 'TEMP'); QVDFieldsName: Load '$(vQVDName)' as QVDName, '$(vFieldName)' as FieldName Autogenerate(1); NEXT DROP Table TEMP; NEXT FOR i=1 to NoOfRows('QVDFieldsName') LET vQVDName = Peek('QVDName',$(i)-1,'QVDFieldsName'); LET vFieldName = Peek('FieldName',$(i)-1,'QVDFieldsName'); [Поиск поля по значению]: LOAD Distinct '$(vQVDName)' As [Название QVD], '$(vFieldName)' As [Название поля], [$(vFieldName)] As [Значение поля] FROM '$(directoryName)$(vQVDName)'(qvd); NEXT QUALIFY *; FOR i=1 to NoOfRows('FileList') LET vQVDName = Peek('FileName',$(i)-1,'FileList'); LET vTableName = Replace('$(vQVDName)','.qvw',''); [$(vTableName)]: LOAD * FROM '$(directoryName)$(vQVDName)'(qvd); NEXT UNQUALIFY *; //Удаляем таблицу DROP Table QVDFieldsName; //Удаляем таблицу DROP Table FileList; FOR iCount = 0 to NoOfTables()-1 LET vTableName = TableName(iCount); [Количество записей]: LOAD '$(vTableName)' As [Наименование таблицы], NoOfRows('$(vTableName)') As [Количество записей], NoOfFields('$(vTableName)') As [Количество столбцов] AutoGenerate 1; NEXT iCount |