VB Script/HTML, I want to filter my date so that it is only showing the data when TaskName is = "DCR - Checker" and "DCR - Designer"

Viewed 14

This is the code I have. TaskName is the variable so I guess kind of want something that is If ReportArrayNames = TaskNamw then show the data column I tried different way and it is not working.This also has some SQL that im not familiar with but I need some help. I know the WriteAgedItems might have something to do with it but thats it

 ```
    <%@ Language=VBScript %>
    <%
     Option Explicit
    Dim DB 'Database Reference
      Dim RS 'Hold for SQL data
    Dim X  '**NOT SURE**
    Dim ConfigFile '**NOT SURE**
    Dim CFG '**NOT SURE**
    Dim FlowID 'Workflow ID of interest
    Dim FlowName 'Workflow Name of interest
    Dim ReportArrayTaskID1 'Workflow tasks to be displayed
    Dim ReportArrayTaskID2 'Workflow tasks to be displayed
    Dim ReportArrayNames 'Workflow task name to be displayed
    Dim i 'Count for table display loop
    Dim j 'hold value of i

   'Get Config File and Open Database
    ConfigFile = Request.ServerVariables("APPL_PHYSICAL_PATH") & "..\Data\ServerConfig.XML"
    Set CFG = Server.CreateObject("LVDMSCoreB.ServerConfig")
    CFG.XML_LoadFromFile CStr(ConfigFile)
    Set DB = CFG.GetDatabaseServerConnection()

'Get the Flow Name from its ID
FlowID = 49
Set RS = DB.Execute("Select FlowName From FlowDefinitions Where FlowDefinitionID=" & FlowID)
FlowName = Rs("FlowName")
RS.Close

Response.Write "<link rel=""shortcut icon"" type=""image/x-icon"" href=""208.ico"" />"
Response.Write "<meta http-equiv=""refresh"" content=""300"">"
Response.Write "<link rel=""Stylesheet"" type=""text/css"" href=""WFSTYLE.CSS"" />"
Response.Write"</head><body>"
Response.Write "<ul>"
Response.Write "<li><a href=""default.asp"">Reports Home</a></li>"
Response.Write "</ul>"
Response.Write "<center> Updated at: " & Time
Response.Write "<center><h2>EAR Forms Report</h2>"

'****************************************
'******** Tables to display data ********
'****************************************

ReportArrayNames = array("DCR - Designer", "DCR - Checker")

'Table for Confirmation Email to be sent to Approver and Requester as applicable.
  Response.Write "<table class=""GeneralTable"")"
'  Response.Write "<col style=""width:1550"">"
'  Response.Write "<col style=""width:30"">" 
'  Response.Write "<col style=""width:30"">" 
'  Response.Write "<col style=""width:120"">" 
'  Response.Write "<col style=""width:120"">" 
'  Response.Write "<col style=""width:100"">"
'  Response.Write "<col style=""width:150"">" 
'  Response.Write "<col style=""width:50"">" 
'  Response.Write "<col style=""width:200"">" 
'  Response.Write "<col style=""width:125"">" 
'  Response.Write "<col style=""width:125"">" 
'  Response.Write "<col style=""width:100"">" 
'  Response.Write "<col style=""width:50"">" 
'  Response.Write "<col style=""width:200"">" 
'  Response.Write "<col style=""width:150"">" 
WriteAgedItems 0, 0
  Response.Write "</table>"
 
Response.Write "</body></html>"
DB.Close

'-----------------------------------
Sub WriteAgedItems(AgeStart, AgeEnd)
Dim RSItems
Dim SQL
Dim RecCount

RecCount = 0

SQL = ""
SQL = SQL & " Select DateDiff(s,FlowInstances.CurrentTaskStartDate, GetDate()) as TaskAge, FlowInstances.DocumentRecordID, Tasks.TaskName, Users.UserName, Users.FullName,"
SQL = SQL & " DR.EAR_NO, DR.TDC_PN, DR.Initiator, FlowInstances.CurrentTaskStartDate"
SQL = SQL & " From FlowInstances Left Join Tasks On FlowInstances.CurrentTask=Tasks.TaskID "
SQL = SQL & " Left Join Users on Users.UserID=FlowInstances.CurrentUser "
SQL = SQL & " Inner Join DocumentRecords_423 DR ON DR.RecordID=FlowInstances.DocumentRecordID "
If AgeEnd = 0 Then
  SQL = SQL & " Where FlowInstances.FlowDefinitionID=" & FlowID & " AND FlowInstances.FlowComplete=0 And DateDiff(d,FlowInstances.CurrentTaskStartDate, GetDate())>=" & AgeStart & " And DR.Department<>'END'"
Else
  SQL = SQL & " Where FlowInstances.FlowDefinitionID=" & FlowID & " AND FlowInstances.FlowComplete=0 And DateDiff(d,FlowInstances.CurrentTaskStartDate, GetDate())>=" & AgeStart & " And DateDiff(d,FlowInstances.CurrentTaskStartDate, GetDate()) <= " & AgeEnd
End If

 SQL = SQL & " Order by Dr.Department ASC, CurrentTaskStartDate DESC"

Set RSItems = DB.Execute(SQL)

  Response.Write "<TR><th>EAR NO</th><th>Part Number</th><TH>Initiator</TH> <th>Top Assembly P/N</th> <th>Date Submitted</th> <th>BOM Change</th> <th> MGF Engineering Drawing</th> <th>Relaunch Production</th> <th>Define Action</th> <th>Current Task</th> </TR>"
Do Until RSItems.Eof
  
  Response.Write "<TR>"
  Response.Write "<TD>" & RSItems("EAR_NO") & "</TD>"
  Response.Write "<TD>" & RSItems("TDC_PN") & "</TD>"
  Response.Write "<TD>" & RSItems("Initiator") & "</TD>"
  Response.Write "<TD> </TD>"
  Response.Write "<TD> </TD>"
  Response.Write "<TD> </TD>"
  Response.Write "<TD> </TD>"
  Response.Write "<TD> </TD>"
  Response.Write "<TD> </TD>"
  Response.Write "<TD>" & RSItems("TaskName") & "</TD>"

  RSItems.MoveNext
  RecCount = RecCount + 1

Loop
RSItems.Close

Response.Write "<TR><TD ColSpan= 14><Center>" & RecCount & " Items</Center></TD></TR>"


End Sub

%>

0 Answers
Related