Register   |   Login


BasicScript Questions to AdamView Builder

BasicScript Questions to AdamView Builder

first I want to apologize for my bad english, but I need your help very much.

I want to get familar with BS-Programming in the AdamView Builder but I still have a lot of problems.

Is it possible to get Data of the Tag-Elements in the Task-Environment?
For example I want to read configuration-data from an ini-File (that already works) and write this data in the Tags.
I have allready got the Tag:

dim mytag as tag
set mytag = GetTag("TASK1","ALOG1")

Now I want to change for example High-High-Value- how can I do this?

Thank You very much.


[ Last edited by afkoernaf at 2009-11-29 00:22 ]



I don't think you can modify the internal properties of the Alarm block from the BasicScript.  The limits can only be set from the builder window.

You can only write a tag value in Basicscript if the tag has been defined as a Virtual Tag(Setup-Add/Delete Virtual Tags).  Or you can output from BasicScript with the "Outputi #,*" where # is a number from 0-7 and * is a value.


Thank you very much for the answer.
But I still have another problem:
I have to make a program that automaticaly logs the Data in an Excel-document.
If this isnt possible- it should at least be able to export the recorded data in an Excel-format.

How can i do this?

I know how to write an Excel-Document:
Sub SCR1()
Dim xlApp as Object
Dim xlBook as Object
Dim xlSheet as Object

Set xlApp = CreateObject("excel.application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add

xlSheet.Cells(1, "a") = "Test"
xlBook.SaveAs "C:\testtabelle.xls"

End Sub
I think the performance is going down when I take each value (in realtime) form the AI und write this into a file.
Is it possible to take the past Data and write each value in such an Excel-file? How can I get past Data-Values?
The standard Log-Tag from the AdamView-Builder only allows to write comma-seperated files.

I hope you understand what I mean.

Thanks a lot for your help.


I think the best way to write values and not impact the performance of the application is via a CSV file.

Either using the log block or through basicscript like this:
option explicit
Sub SCR1()
    dim MyTag as Tag

    set MyTag = GetTag ("TASK1", "AI1")  

        Open "test.csv" For Append Access Write As #1
        Write #1,Now(),MyTag

End Sub


Simulation pret immobilier

The best way to write values and not impact the performance of the application is via a CSV file


Thanks for the help.
The Idea with the CSV was great- i simply append a ; to the Outputvalue and the Log-Block does the rest.


How to save data in different format?


Ive notice in AdamView, using an Adam 4017 and 4520 that the log block allows for storage only ASCII type. If i change it to integer or long integer i get no results of my values. I store the values from Adam 4017 with the log block into an excel file, or csv file but the problem is the data there is ASCII so i cannot add other operations or functions in that sheet. I want for each value stored to add some formulas, what can i do to store my values in a decimal format?

Thank you,


Quick search in Advantech Support Portal