Advertisement
Guest User

Untitled

a guest
Aug 7th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. FOR i = 0 to NoOfRows('tables')-1
  2. LET sheetName = purgeChar(purgeChar(peek('TABLE_NAME', i, 'tables'), chr(39)), chr(36));
  3. LET file_path = purgeChar(purgeChar(peek('TABLE_CAT', i, 'tables'), chr(39)), chr(36));
  4. IF sheetName='Sheet1' THEN
  5. Employees:
  6. LOAD Distinct //Added distinct since the belgium dummy data is not unique, it is made from the training data
  7. '1' AS IND_EMPLOYEE_DATA,
  8. ====> [Pers.nr.] AS EMPLOYEE_ID,
  9. // ID is required for export functionality
  10. [Pers.nr.] AS ID,
  11. [Practice] AS PRACTICE_CODE,
  12. //[EG],
  13. [Aanspreeknaam] AS EMPLOYEE_NAME,
  14. [Emailadres]
  15. FROM $(file_path) (ooxml, embedded labels, table is [$(sheetName)]) where IsNum([Pers.nr.]) AND [EG] = 'CSS-P' AND
  16. match([Practice],'B50','B60','B61','B63','B65') > 0; //Added the BE Gxx practices
  17.  
  18. // FROM $(file_path) (ooxml, embedded labels, table is [$(sheetName)]) where IsNum([Pers.nr.]) AND [EG] = 'CSS-P' AND
  19. // match([Practice],'B50','B60','B61','B63','B65') > 0; //Added the BE Gxx practices
  20. ENDIF
  21. NEXT
  22. DROP Table tables;
  23.  
  24. //////////////////////////////////////////////
  25. //2. Load the source data for Financial KPIs//
  26. //////////////////////////////////////////////
  27.  
  28. LET vDir = '$(vPathF)' & '*.xlsx';
  29. //Find files in path and loop over the files and append data to the tables table
  30. FOR Each file in FileList(vDir)
  31. ODBC CONNECT32 TO [Excel Files;DBQ=$(file)];
  32. tables: //make table tables from the DB info created by the ODBC connection
  33. SQLtables;
  34. DISCONNECT; // Don't need ODBC connection anymore
  35. NEXT
  36.  
  37.  
  38. //One of the fields loaded by SQLtables is "TABLE_NAME". This field will contain the sheet names located in the workbooks.
  39. //TABLE_CAT contains the full path to the file with the filename and extention
  40. //We will loop through this set of sheet names.
  41.  
  42.  
  43. //////////////////////////////////////////////
  44. //3. Load the source data for Training data //
  45. //////////////////////////////////////////////
  46.  
  47. Let vDir = '$(vPathCL)' & '*.xlsx';
  48. FOR Each file in FileList(vDir)
  49. ODBC CONNECT32 TO [Excel Files;DBQ=$(file)];
  50. tables:
  51. SQLtables;
  52. DISCONNECT;
  53. NEXT
  54.  
  55. FOR i = 0 to NoOfRows('tables')-1
  56. LET sheetName = purgeChar(purgeChar(peek('TABLE_NAME', i, 'tables'), chr(39)), chr(36));
  57. LET file_path = purgeChar(purgeChar(peek('TABLE_CAT', i, 'tables'), chr(39)), chr(36));
  58. IF sheetName='Sheet1' THEN
  59. Career_Learning:
  60. LOAD distinct
  61. [Activity Code] AS TRAINING_CODE,
  62. [Activity Name] AS TRAINING_NAME,
  63. [LocalEmpNumber] AS EMPLOYEE_ID,
  64. [Registration Status] AS TRAINING_REGISTRATION_STATUS,
  65. Year([Attempt Completion Date]) AS TRAINING_COMPLETION_YEAR,
  66. Month([Attempt Completion Date]) AS TRAINING_COMPLETION_MONTH,
  67. MonthStart([Attempt Completion Date]) AS TRAINING_COMPLETION_YYYYMM
  68. ===> FROM $(file_path) (ooxml, embedded labels, table is [$(sheetName)]) where IsNum([LocalEmpNumber]) and [Registration Status] = 'Completed';
  69. ENDIF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement