YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Get various values with change a cell in excel Options · View
Chrischi
#1 Posted : Tuesday, November 01, 2011 3:56:49 PM
Rank: Newbie
Groups: Member

Joined: 11/1/2011
Posts: 4
Location: Germany
Hi there, I'm new here because we have at work many problems with a new version of PIBook and DataLink.
I hope I can explain it good, because my english is not the best.

From the beginning: At work, we have a large excel file with many values of PIBook, this version works perfectly for years (with the old version of PIBook and DataLink), a few days ago we got a new version of PIBook and DataLink and now nothing will be show from PIBook in this Excel sheet.
The server is up and running and another Excel files with values work perfectly.
In this file we had the following formula "=PIcurrval("T123.lvl";0;"Rheinland").
But in the excel sheet, that don't work since the update, we had a formula that I don't understand or can do something with it.
There stand at all "=Wmm(Tnow, C2). I think mm stands for millimeters, because we had another formula with "=Wden..." that us show the density, "C2" is the cell where to get the first part of the tag.
We tried many things with the server, I tried many things with the formula "=PIcurrval" but nothing worked, so we want it.
For example: in the field "C2" we have a Tank "T123" and in "D2" we want, we can see the current level of this tank(This is easy "=PIcurrval("T123.lvl";0;"Rheinland") ), but the tanks are often switch and we want, that the level switch automatically with it, means when we change "C2" to "T145", "D2" with the level change too, after a reload.
I had tried various things like "=PIcurrval("$C$2:lvl";0;"Rheinland"), without the $ and instead of the : only a point, without the " and so on.

Is it possibly to make it with this or work it only with a macro in VBA? We don't have anything against a macro or a multi solution (macro and formula together), we only want that the excel sheet work. At work we have a support for PIBook, but they say "PIBook running and so this is not our problem."Cursing , that is why I hope you can help me(us).


With kind regards
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
caffreys_col
#2 Posted : Wednesday, November 02, 2011 9:36:37 AM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2011
Posts: 40
Location: Grimsby UK
Ok, lets get some basics sorted out.

Are you trying to get data from a Processbook display in to an Excel sheet, or are you just getting data back from the PI server? Using the PIcurrval function would suggest you are just getting data from the PI server.

If thats the case then lets try and fault find.

1. You say that other Excel sheets that get PI data back from the PI server work ok: Do these sheets work on the same computer that you are trying to run the sheet that does not work? If the answer is yes then its a problem with the Excel sheet. If not then it's probably a problem with the computer.

Check that the "faulty" Excel sheet is connecting to the PI server. If it is not then you will not get any data. When you open the faulty Excel sheet check you are connected to the correct PI server using a suitable login name. If the login doesn't give you access to the data then you will not get any data back - make sure the permissions of the login you are using are ok, for example they should be set to; owner: read/write access, group: read/write, World:read only.

2. To automatically update the tagname in a cell, use the If statement in Excel. Something like...
IF(value > 50, $a$4, $a$5)
This selects the value/text in cell a4 if the value is <50, and cell a5 if >50 (I think!! You better check the syntax within the Excel Help!). You will have to adjust the test condition (value > 50) to whatever you require.

I hope this helps to bottom out your problem.
Chrischi
#3 Posted : Wednesday, November 02, 2011 11:03:15 AM
Rank: Newbie
Groups: Member

Joined: 11/1/2011
Posts: 4
Location: Germany
Thanks for your fast help.

I want to get the data from the PI Book server, because the values we need are over more than 5 PI Book display and thats for me now, more dificult because the various site in a formula and the tags that change. Sounds very dificult for me.

To 1.
We have tested the faulty and a working sheet on 2 different computers. Both are the same on the different computers, the faulty don't work and the working get all the data from the PI Book Server.
The faulty is connected with PIBook, because in the faulty sheet I used a cell and wrote in this cell, for testing the connection:"=PIcurrval("t123.lvl",1,"Rheinland"), and i get the level of the tank shown up. I think the problem is only the strange formula "=Wmm(Tnow,C2)".

With the "if function" I think it wouln't work, because we have for some products more than 2 tanks or I don't see the solution you mean. Many thanks to you caffreys_col you gave me a good idea with the Excel Help.

I think about my formula and had another idea, which I want to try at work. The formula is following: =PIcurrval(" C2 &.lvl";1;"Rheinland"). I don't know if this works, but it is for me with the help of the "Excel Help" the only choice.
caffreys_col
#4 Posted : Wednesday, November 02, 2011 11:37:07 AM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2011
Posts: 40
Location: Grimsby UK
If you want to add a tag name to some text then try..
=concatenate(C2, ".lvl")
that would merge together the text in cell c2 with the text .lvl
For example cell C2 = T145... the formula concatenate (c2,".lvl") would give you text of T145.lvl as the cell result.

I suggest you put this in a separate cell such that your formula uses one cell reference, for example... =Picurrval(c3;1;"rheinland"), where c3 = concatenate(c2, ".lvl"). Does that make sense??

As for your strange formula (=Wmm(Tnow,c2); it could be a predefined formula/macro within the Excel sheet which references another macro (Tnow) and a cell reference (c2) in order to calculate something. You might have to check your VB code to see if Wmm is a defined function, and what it uses to define the macro. Apart from that I can't think of anything that makes sense. The function Wmm is not part of another add-in to Excel (like Datalink)is it?? I'm grasping at straws for possible answers now!!

Chrischi
#5 Posted : Wednesday, November 02, 2011 12:30:39 PM
Rank: Newbie
Groups: Member

Joined: 11/1/2011
Posts: 4
Location: Germany
caffreys_col wrote:
If you want to add a tag name to some text then try..
=concatenate(C2, ".lvl")
that would merge together the text in cell c2 with the text .lvl
For example cell C2 = T145... the formula concatenate (c2,".lvl") would give you text of T145.lvl as the cell result.

I suggest you put this in a separate cell such that your formula uses one cell reference, for example... =Picurrval(c3;1;"rheinland"), where c3 = concatenate(c2, ".lvl"). Does that make sense??



Yes, for me it makes sense, but when the 2 cells in one formula, this is the best solution for me. My idea is following: Cell C2 = 145 and in C3 are the formula =PIcurrval("(c2,".lvl")";1;"Rheinland"), but there is the Problem, that Processbook don't know the tag or id. I want that PIbook don't give back the failure that this is not a tag or id. I think so, because I'm at the moment not at work, so I can't testing it.

If my first idea don't work, so I can add a colum, paste the formula that you wrote =concatenate(C2, ".lvl") and hide the column, so is there no blemish.

Yesterday I looked in the VB and there is only one macro that show if the level of a tank is falling or increasing and shows this with a "+" or a "-". But this macro works only with the level of the tank and get no data direct from PIBook. Wmm is not a part of another Excel Add-In because the only add-In we have is PIBook. Thats why it is strange for me.


I'm now enroute to work, so I can test all the solutions you posted. Thanks you very much. I will come back to you if it works or PIBook give back a failure.


Thank you.
Chrischi
#6 Posted : Wednesday, November 02, 2011 6:22:03 PM
Rank: Newbie
Groups: Member

Joined: 11/1/2011
Posts: 4
Location: Germany
Sorry for a double post but for all they have the same problem here my solution:

For example: in cell A1 is a value that you change in my case "T123" and "T145".
In A2 is this formula: =PICurrVal(A1 &".lvl";0;"Rheinland"). "Rheinland" is only the Server we use. I'm from Germany near Cologne Cool. In First case in A1 is T123, with the formula you have then follow formula: =PICurrVal(T123.lvl;0;"Rheinland"), after press F9, you get the Level of T123 in A2. If the Tanks change, in this, to T145, Change this in A1 to t145, now are the formula =PICurrVal(T145.lvl;0;"Rheinland") and After Press F9 you get the level of Tank 145.ThumbsUp

Many thanks to caffreys_col for your help.


Case closed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.