4/2/2013 5:02 AM | |
Posts: 140 Rating: (0) |
Dear Whiteford, For the action2, siemens help code, I modified the select statment and now I recieve the attached error. Pleas esuggest. Thanks
|
4/11/2013 3:03 PM | |
Posts: 1776 Rating: (95)
|
HI, have you also seen this FAQ http://support.automation.siemens.com/WW/view/en/16514261 |
4/11/2013 3:19 PM | |
Posts: 140 Rating: (0) |
Dear April, Thanks for your reply. Yes I have seen this FAQ and I have implemented this similiar solution for my issue as explained earlier in this post. But now I want to make a slight modification to the code to read the value of I/O field and search the value corresponding to that, like a look up table. Please read carefully. Thanks Khyzer
|
4/12/2013 4:33 AM | |||||||||
Posts: 140 Rating: (0) |
Dear Experts, I have got the above task working. Now I need to look into the case where user key in a value which is not in the table. Like user key in 26.5 so it should output interpolated value between 30 and 35. Any suggestions? Thanks Khyzer
|
||||||||
4/18/2013 4:05 AM | |
Posts: 140 Rating: (0) |
Dear Experts, I have tested some SQL Queries on the above database using a 3rd part Software (MDB Viewer) and they work fine. However I tried to implment that in WinCC but unable to achieve any success. I have three following quries: first query called interpolation_left: SELECT TOP 1 1 AS id, [VAL] AS val_left FROM TAGS WHERE [TAGNAME] < '"&InputValue&"' ORDER BY [TAGNAME] DESC;
|
5/6/2013 12:16 PM | |||||||||
Posts: 140 Rating: (0) |
Dear Experts, I want to run multiple queries within the code below which works fine for running a single query to access data from an access database. Can anyone help me to modify the code to run more than one queries and save them in seperate variables? Code to search value of column ‘VAL’ by inputting value for column ‘TAGNAME”
'VBS108a Dim objConnection Dim objCommand Dim objRecordSet Dim strConnectionString Dim strSQL Dim lnputValue Dim lngValue Dim lngCount strConnectionString = "Provider=MSDASQL;DSN=SampleDSN;UID=;PWD=;" lnputValue = HMIRuntime.Tags("TagB").Read strSQL = "Select VAL from TAGS WHERE TAGNAME='"&lnputValue&"'" Set objConnection = CreateObject ("ADODB.Connection") objConnection.ConnectionString = strConnectionString objConnection.Open Set objRecordSet = CreateObject ("ADODB.Recordset") Set objCommand = CreateObject ("ADODB.Command") objCommand.ActiveConnection = objConnection objCommand.CommandText = strSQL Set objRecordSet = objCommand.Execute lngCount = objRecordset.Fields.Count If (lngCount> 0) Then objRecordset.movefirst 'lngValue objRecordSet.Fields = (0). Value lngValue = objRecordset.Fields(0).Value 'lngValue = lnputValue HMIRuntime.Tags ("TagC"). Write lngValue Else HMIRuntime.Trace "Selection returned no fields" & vbNewLine End If Set objCommand = Nothing objConnection.Close Set objRecordSet = Nothing Set objConnection = Nothing |
||||||||
Follow us on