f_reportlist_array.srf 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. $PBExportHeader$f_reportlist_array.srf
  2. global type f_reportlist_array from function_object
  3. end type
  4. forward prototypes
  5. global subroutine f_reportlist_array (string arg_reportliststr)
  6. end prototypes
  7. global subroutine f_reportlist_array (string arg_reportliststr);Long ll_cnt,cnt
  8. String ls_reportstr
  9. Long ll_reportid
  10. Long local_report[]
  11. ls_reportstr = arg_reportliststr
  12. IF Trim(arg_reportliststr) = '' THEN
  13. local_report[1] = 0
  14. ELSE
  15. IF sys_power_issuper OR arg_reportliststr = '0' THEN
  16. sys_user_reportstr = '0'
  17. SELECT count(*) INTO :cnt
  18. FROM u_report_user;
  19. IF sqlca.SQLCode <> 0 OR cnt = 0 THEN
  20. ll_cnt++
  21. local_report[ll_cnt] = 0
  22. ELSE
  23. DECLARE cur_report CURSOR FOR
  24. SELECT u_report_user.reportid
  25. FROM u_report_user ;
  26. OPEN cur_report;
  27. FETCH cur_report INTO :ll_reportid;
  28. DO WHILE sqlca.SQLCode = 0
  29. ll_cnt++
  30. local_report[ll_cnt] = ll_reportid
  31. FETCH cur_report INTO :ll_reportid;
  32. LOOP
  33. CLOSE cur_report;
  34. END IF
  35. ELSE
  36. sys_user_reportstr = arg_reportliststr
  37. DO WHILE Len(ls_reportstr) <> 1
  38. ls_reportstr = Replace( ls_reportstr, 1, 1, '' )
  39. ll_reportid = Long(Left(ls_reportstr,Pos(ls_reportstr,',',1) - 1))
  40. ll_cnt++
  41. local_report[ll_cnt] = ll_reportid
  42. ls_reportstr = Replace ( ls_reportstr, 1, Pos(ls_reportstr,',',1) - 1, '' )
  43. LOOP
  44. END IF
  45. END IF
  46. sys_user_report = local_report
  47. end subroutine