mannakhan10's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
14 (0.01 per day)
Joined:
21-May 11
Profile Views:
377
Last Active:
User is offline Apr 16 2013 06:28 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   mannakhan10 has not set their status

Posts I've Made

  1. In Topic: Connecting to SDK Server but syntax/assembly reference error?

    Posted 15 Apr 2013

    Nevermind, figured it out I think.

    meServer = MySDK.Servers.item(meServer); #Connect to Server
    


    Changed to:

    meServer = MySDK.Servers[meServer]; #Connect to Server
    
  2. In Topic: ASP - Arithmetic Operations within Array

    Posted 31 Jan 2013

    View Postrgfirefly24, on 30 January 2013 - 10:21 AM, said:

    How have you tried to debug this? have you set a bunch of response writes to see the values in your array/variables?

    Also I don't know what you're expecting exactly by putting in the - 32 in your array, but the array is of type Array(Of Array(Of string)) which means that each of the inner arrays is an Array of strings so no subtraction can be done on it. It is immutable which means you can't change it. you can do a REPLACE to replace the text for the tag name with it's actual value then convert it to a double or something of the sort

    Try this:

    CDBL(REPLACE("TEMP:01","TEMP:01","32")) - 32
    
    


    ofcourse you'll replace the last number in the REPLACE with what ever value comes out of the database


    I'm not sure I fully understand.
    I cannot change the last number in the REPLACE with any set value. The database server will feed me real time temperature readings that change by the minute.
    Also, I've never used a replace function, but I would insert it right below my array if I assume correct?

    You make a good point about it being a String. In ASP is there a way to convert a string into an integer?
    I've tried cInt(TEMP:01) before the fuction with no luck.

    If there was a way to convert that constantly changing value from TEMP:01 into an integer, I could use it in any arithmetic operation.
  3. In Topic: ASP - Arithmetic Operations within Array

    Posted 30 Jan 2013

    View Postrgfirefly24, on 29 January 2013 - 01:57 PM, said:

    View Postandrewsw, on 28 January 2013 - 02:12 PM, said:

    [Is this VBScript or VB.Net? Dunno.]


    To answer this question it will be VBScript as "Classic" ASP (ASP 3.0) used VBScript.


    As for mannakhan10, I'm not exactly sure I understand what your asking. You're kind of all over the place in your posts. I will review what you have a few times to see if I understand it, but in the mean time if you can post the entirety of your code. I think part of the confusion is that we get little bits and pieces. Specifically related to BuildTable0 as I think your problems are in there.


    I guess to put it in the most simplest form:
    TEMP:01 is a static numerical value that I connect to a server and pull the information using the Tag.
    However, in the array, it displays the numerical value of TEMP:01 which is 35. The Target Value is 32.
    I need the array to take the server tag (TEMP:01) numerical value of 35, and find the difference between the Target Value of 32.
    Example:

    u7 = Array(_  
    Array("", "", "", ""), _  
    Array("Temperature", "TEMP:01", 32, "TEMP:01 -" & 32) _
    


    I get errors like:
    Tag < TEMP:01 -32 > not found 2

    I think it sees that part of the array as a one of the Tag values as well.

    Is there a way to take the Tag Value (TEMP:01) and store the numerical value it gives by assigning it to something and then carrying out the arithmetic function, which will show the difference on the page?

    Here is the code in its entirety. But the Tag values will not be visible to you since you cannot connect to the servers.
    Sorry for the inconvenience:

    <html>
    
    <head>
    <title>Temp And Pressure Checker</title>
    <style>
    body
    {
    	background-color:black;
    }
    
    .clsTable
    {
    
    	cellspacing: 0;
    	cellpadding:0;
    	font-weight: bold;
    	font-size: 8pt;
    	color: white;
    	font-family: Tahoma;
    	background-color:black;
    	frame:void;
    }
    </style>
    </head>
    
    <body>
    
    <%
    
    On Error Resume Next
    
    ' PI connection parameters '
    Dim sPIconn, sPIuser, sPIpwd
    sPIconn = "ps-server"
    sPIuser = "demo"
    sPIpwd = ""
        
    ' Error Handler - Displays error message on page '
    sub ErrorHandler(iNum)
    	response.write "<TABLE class = 'clsTable'>"
    	response.write "<TR><TD>Error:<BR>" & Err.Description & " " & iNum & "</TD></TR>"
    	response.write "</TABLE>"
    	response.end
    end sub
    
    ' BuildSQL - Builds the list of tags from the tag array '
    function BuildSQL(whereArray, strWhere)
    	if BuildSQL = "" then
    		for iArea = 0 to ubound(whereArray)
    			for iTag = 0 to ubound(whereArray(iArea))
    				if iTag <> 0 then
    					if Len(whereArray(iArea)(iTag)) > 4 then
    						if strWhere <> "" then
    							strWhere = strWhere & " , "
    						end if
    
    						strWhere= strWhere & "'" & whereArray(iArea)(iTag) & "'"
    					end if
    				end if
    			next
    		next
    		BuildSQL = strWhere
    	end if
    end function
    
    ' BuildTable - Builds the HTML table for a specified tag array '
    function BuildTable(tableArray, oRecordset, iRound)
    	for iArea = 0 to ubound(tableArray)
    		response.write "<TR>"
    		for iTag = 0 to ubound(tableArray(iArea))
    			if iTag = 0 or Len(tableArray(iArea)(iTag)) <= 4 then
    				response.write "<TD align='left'>"
    				response.write tableArray(iArea)(iTag)
    			else
    				response.write "<TD align='right'>"
    				if (oRecordset("tag") = tableArray(iArea)(iTag)) then
    					if oRecordset("RVal") = "0" and oRecordset("status") <> "0" then
    						response.write Round(oRecordset("status"), iRound)
    					else
    						'response.write Round(oRecordset("RVal"), iRound)
    						dim num
    						num = oRecordset("RVal")
    						num = FormatNumber(num,1)
    						response.write num
    					end if
    
    					oRecordSet.MoveNext
    				else
    					response.write "Tag not found."
    				end if
    			end if
    			response.write "</TD>"
    		next
    		response.write "</TR>"
    	next
    end function
    
    ' BuildTable0 - Builds the HTML table for a specified tag array ' (no decimal places)
    function BuildTable0(tableArray, oRecordset, iRound)
    	for iArea = 0 to ubound(tableArray)
    		response.write "<TR>"
    		for iTag = 0 to ubound(tableArray(iArea))
    			if iTag = 0 or Len(tableArray(iArea)(iTag)) <= 4 then
    				response.write "<TD align='center'>"
    				response.write tableArray(iArea)(iTag)
    			else
    				response.write "<TD align='right'>"
    				if (oRecordset("tag") = tableArray(iArea)(iTag)) then
    					if oRecordset("RVal") = "0" and oRecordset("status") <> "0" then
    						if oRecordset("text") = "" then 
    						response.write Round(oRecordset("status"), iRound)
    						elseif oRecordset("text") = "YES" then 
    							response.write "ON"
    						elseif oRecordset("text") = "YES" then 
    							response.write "OFF"
    						else 
    						response.write oRecordset("text")
    						end if
    					else
    						'response.write Round(oRecordset("RVal"), iRound)
    							dim num
    							num = oRecordset("RVal")
    '							num = FormatNumber(num,1) then
    							num = FormatNumber(num,1)
    							response.write num
    					end if
    					oRecordSet.MoveNext
    				else
    					response.write "Tag not found."
    				'response.write Orecordset("Rval")
    				end if
    			end if
    			response.write "</TD>"
    		next
    		response.write "</TR>"
    	next
    end function
    
    ' Open the PI ODBC connection '
    Set oConnection=Server.CreateObject("ADODB.Connection")
    oConnection.Open sPIconn, sPIuser, sPIpwd
    if Err.number  <> 0 then
    	ErrorHandler 1
    end if
    
    ' Initialize all tag arrays for Unit 7'
    Dim u7
    u7 = Array(_
        Array("", "", "", ""), _
        Array("Temperature", "TEMP:01", "32", ""), _
    	Array("Pressure", "PSI:514", "100", "") _
    
        )
    
    
    ' Display the current date and time '
    response.write "<TABLE class = 'clsTable'>"
    response.write "<TR>"
    response.write "<TD>" & Now & "</TD>"
    response.write "</TR>"
    response.write "</TABLE>"
    
    ' Gross Megawatt SNA table
    
    
    ' Build the WHERE clause of the SQL statement with all the tag names '
    strWhere = ""
    strWhere = BuildSQL(u7, strWhere)
    strSQL = "SELECT status, tag, text = DIGSTRING(status), Rval=Value FROM picomp WHERE tag in (" & strWhere & ") AND Time = DATE('*')"
    
    ' Execute the SQL statement'
    Set oRecordSet = oConnection.Execute(strSQL, nRec)
    if Err.number  <> 0 then
    	ErrorHandler 2
    end if
    
    ' Build the 'vib USS' table '
    response.write "<HR><TABLE class = 'clsTable'>"
    response.write "<TR>"
    response.write "<TD><U> Unit 7 </U></TD>"
    response.write "</TR>"
    response.write "<TR>"
    response.write "<TD><U>Descriptions</U></TD>"
    response.write "<TD><U> Current Value </U></TD>"
    response.write "<TD><U> Target Value </U></TD>"
    response.write "<TD><U> Difference </U></TD>"
    response.write "</TR>"
    BuildTable0 u7, oRecordset, 0
    response.write "</TABLE>"
    
    
    ' Build the WHERE clause of the SQL statement with all the tag names '
    strWhere = ""
    strWhere = BuildSQL(rrgArray, strWhere)
    strSQL = "SELECT status, tag, Rval=Value FROM picomp WHERE tag in (" & strWhere & ") AND Time = DATE('*')"
    
    
    ' Close PI connection '
    oRecordset.Close
    oConnection.Close
    
    Set oRecordset = Nothing
    Set oConnection = Nothing
    
    %>
    </body>
    </html>
    
  4. In Topic: ASP - Arithmetic Operations within Array

    Posted 28 Jan 2013

    I have tried the following code:

    ' Initialize all tag arrays for Unit 7'
    Dim intTemp
    intTemp = 32
    Dim u7
    u7 = Array(_
    Array("", "", "", ""), _
    Array("Temperature", "TEMP:01", intTemp, "TEMP:01 -" & intTemp) _
    


    However, it does not calculate out the value to be displayed. It just displays:
    Tag < TEMP:01 -32 > not found 2

    on the page.
    From what I can tell, it sees the whole part:
    "TEMP:01 -" & intTemp
    

    from:
    Array(... , ... , ... , "TEMP:01 -" & intTemp) _
    


    as one of my PI tags...

    Is there any possible way to store that static value from "TEMP:01" as an integer or variable?

    I've been searching all over Google and there's a bunch of stuff for ASP.NET but not ASP.

    And I am using the default scripting language for ASP, VBscript.

    Thanks for all the help and patience so far andrewsw.
  5. In Topic: ASP - Arithmetic Operations within Array

    Posted 28 Jan 2013

    ' Initialize all tag arrays for Unit 7'
    Dim intTemp, intPi
    intTemp = 32
    intPi = 30
    Dim u7
    u7 = Array(_
        Array("", "", "", ""), _
        Array("Temperature", "TEMP:01", intNMT, intNMT - intPi) _
    


    Will display the code on the page as:

    Temperature 33.5 32 2

    However, what my true intention is is to make the code seem similar to this by utilizing the value that is found in the PI tag that will provide the current temperature value:
    ' Initialize all tag arrays for Unit 7'
    Dim intTemp, intPi
    intTemp = 32
    intPi = TEMP:01 //the current numerical values from TEMP:01
    Dim u7
    u7 = Array(_
        Array("", "", "", ""), _
        Array("Temperature", "TEMP:01", intNMT, intNMT - intPi) _
    


    and display as on the ASP page:

    Temperature 34.58 32 2.58

    View Postandrewsw, on 28 January 2013 - 12:12 PM, said:

    Well, to answer the first question

    Array("Temperature", "TEMP:01", "intTarval", "TEMP:01" - "intTaravl"), _
    is incorrect. If you want to append the value of the variable 'intTaravl' to the end of the text "TEMP:01" then you need to concatenate using the & sign:

    "TEMP:01" & intTaravl
    


    If you want " - " to appear between then you need to include that as well:

    "TEMP:01 - " & intTaravl
    

    BTW You've supplied an awful lot of information which has obscured a straight-forward question.

    Also, from your opening code, make sure that , _ is appropriate at the end of the line. That is, the next line must be a continuation of the current lines' statement.


    That was an error on my part when posting haha.
    However, you have provided much help. I will go ahead and try this out and let you know what errors I get (if any).

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

mannakhan10 hasn't added any friends yet.

Comments

mannakhan10 has no profile comments yet. Why not say hello?