VB脚本/html,我想过滤我的日期,以便它仅在taskname为=; dcr -checker; and&quot” DCR-设计师

发布于 2025-02-11 19:42:58 字数 5535 浏览 1 评论 0原文

这是我拥有的代码。 taskName是变量,所以我想是某种内容,如果reportArrayNames = tasknamw,则显示我尝试过的数据列,但它不起作用。这也有一些我不熟悉的SQL,但我需要一些帮助。 我知道writeagedItems可能与之有关

 ```
    <%@ 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

%>

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

%>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文