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

Modify RTWebPart Shared Properties Options · View
vivek31be
#1 Posted : Wednesday, July 28, 2010 8:40:16 AM
Rank: Newbie
Groups: Member

Joined: 7/7/2010
Posts: 7
Location: New Delhi
Hi All,

I have again come up with a tricky question.

Can we modify shared properties (that comes when we click edit->modify shared properties and a new window comes on right side) using a query string.

For example:-

I want to add the following attribute "Volume" from following AF DataBase "\\Server1\WellData\Element1\Facility1"


I don't know how to do it. Please Help.

Thanks,
Vivek Gupta
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.
vivek31be
#2 Posted : Friday, July 30, 2010 8:40:16 AM
Rank: Newbie
Groups: Member

Joined: 7/7/2010
Posts: 7
Location: New Delhi
Hi All,

I have written code to select Data Source for Trend WebPart as follows:

OSIsoft.PresentationServices.Properties.RtWPDataQuery[] rtdq = new OSIsoft.PresentationServices.Properties.RtWPDataQuery[2];
rtdq[0] = new OSIsoft.PresentationServices.Properties.RtWPDataQuery();
rtdq[1] = new OSIsoft.PresentationServices.Properties.RtWPDataQuery();
OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter[] rtdqp = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter[3];
rtdqp[0] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp[1] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp[2] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp[0].AdhocValue = "";
rtdqp[0].ConfiguredValue = "";
rtdqp[0].DefaultValue = "-2h";
rtdqp[0].ParameterName = "StartTime";
rtdqp[0].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.StartTime;
rtdqp[0].IsDefault = true;

rtdqp[1].AdhocValue = "";
rtdqp[1].ConfiguredValue = "";
rtdqp[1].DefaultValue = "*";
rtdqp[1].ParameterName = "EndTime";
rtdqp[1].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.EndTime;
rtdqp[1].IsDefault = true;

OSIsoft.PresentationServices.Properties.ProviderParameterMapping[] ppm = new OSIsoft.PresentationServices.Properties.ProviderParameterMapping[1];
ppm[0] = new OSIsoft.PresentationServices.Properties.ProviderParameterMapping();

string[] str1 = new string[1];
str1[0] = "";

rtdqp[2].AdhocValue = "";
rtdqp[2].ConfiguredValue = "";
rtdqp[2].DefaultValue = "";
rtdqp[2].ParameterName = "TagNamesX";
rtdqp[2].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.PITag;
rtdqp[2].IsDefault = true;
rtdqp[2].QueryStringElement = "Start Time=Start Time,End Time=End Time,PI TimeRange";
rtdqp[2].SelectedProviderParameterNames = ppm;
rtdqp[2].SelectedProvidersTitle = str1;

rtdq[0].ClientDataResultKey = "PITags";
rtdq[0].dataQueryMode = OSIsoft.RtBaseline.DataAccess.DataQueryMode.ModePlotValues;
rtdq[0].dataQueryState = OSIsoft.PresentationServices.Properties.RtWPDataQuery.DataQueryState.Configured;
rtdq[0].dataQueryType = OSIsoft.PresentationServices.Properties.RtWPDataQuery.DataQueryType.PI;
rtdq[0].ICEParameters = rtdqp;
rtdq[0].Intervals = 400;
rtdq[0].ResultMode = OSIsoft.RtBaseline.DataAccess.DataResultMode.ModeDataSet;
rtdq[0].ViewName = "PITags";

OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter[] rtdqp1 = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter[9];
rtdqp1[0] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[1] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[2] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[3] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[4] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[5] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[6] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[7] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();
rtdqp1[8] = new OSIsoft.PresentationServices.Properties.RtWPDataQueryParameter();

rtdqp1[0].AdhocValue = "";
rtdqp1[0].ConfiguredValue = "";
rtdqp1[0].DefaultValue = "*-2h";
rtdqp1[0].ParameterName = "StartTime";
rtdqp1[0].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.StartTime;
rtdqp1[0].IsDefault = true;

rtdqp1[1].AdhocValue = "";
rtdqp1[1].ConfiguredValue = "";
rtdqp1[1].DefaultValue = "*";
rtdqp1[1].ParameterName = "EndTime";
rtdqp1[1].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.EndTime;
rtdqp1[1].IsDefault = true;

rtdqp1[2].AdhocValue = "";
rtdqp1[2].ConfiguredValue = "";
rtdqp1[2].CurrentValue = "Pressure";
rtdqp1[2].DefaultValue = "Pressure";
rtdqp1[2].ParameterName = "AttributePath";
rtdqp1[2].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.AFAttribute;
rtdqp1[2].IsDefault = false;

rtdqp1[3].AdhocValue = "";
rtdqp1[3].ConfiguredValue = "";
rtdqp1[3].CurrentValue = "\\\\TEST10\\Aseet_Model\\Congo (Asset 1)\\Location1\\Area1\\Facility1";
rtdqp1[3].DefaultValue = "\\\\TEST10\\Aseet_Model\\Congo (Asset 1)\\Location1\\Area1\\Facility1";
rtdqp1[3].ParameterName = "ContextPath";
rtdqp1[3].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.AFContext;
rtdqp1[3].IsDefault = false;

rtdqp1[4].AdhocValue = "";
rtdqp1[4].ConfiguredValue = "";
rtdqp1[4].Description = "Interval";
rtdqp1[4].DefaultValue = "";
rtdqp1[4].ParameterName = "Interval";
rtdqp1[4].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.Other;
rtdqp1[4].IsDefault = true;

rtdqp1[5].AdhocValue = "";
rtdqp1[5].ConfiguredValue = "";
rtdqp1[5].CurrentValue = "12:00:00";
rtdqp1[5].DefaultValue = "12:00:00";
rtdqp1[5].Description = "SyncInterval";
rtdqp1[5].ParameterName = "SyncInterval";
rtdqp1[5].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.AFContext;
rtdqp1[5].IsDefault = true;

rtdqp1[6].AdhocValue = "";
rtdqp1[6].ConfiguredValue = "";
rtdqp1[6].CurrentValue = "";
rtdqp1[6].DefaultValue = "";
rtdqp1[6].Description = "RunningSummary";
rtdqp1[6].ParameterName = "RunningSummary";
rtdqp1[6].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.AFContext;
rtdqp1[6].IsDefault = true;

rtdqp1[7].AdhocValue = "";
rtdqp1[7].ConfiguredValue = "";
rtdqp1[7].CurrentValue = "";
rtdqp1[7].DefaultValue = "";
rtdqp1[7].Description = "Conversion Factor";
rtdqp1[7].ParameterName = "ConversionFactor";
rtdqp1[7].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.AFContext;
rtdqp1[7].IsDefault = true;

rtdqp1[8].AdhocValue = "";
rtdqp1[8].ConfiguredValue = "";
rtdqp1[8].CurrentValue = "";
rtdqp1[8].DefaultValue = "";
rtdqp1[8].Description = "Value filter string";
rtdqp1[8].ParameterName = "FilterString";
rtdqp1[8].ParameterType = OSIsoft.RtBaseline.DataAccess.DataViewParameterType.AFContext;
rtdqp1[8].IsDefault = true;

rtdq[1].ClientDataResultKey = "7cf9bfae-eb1b-46ce-a65e-08d1a4f4ab3e";
rtdq[1].dataQueryMode = OSIsoft.RtBaseline.DataAccess.DataQueryMode.ModePlotValues;
rtdq[1].dataQueryState = OSIsoft.PresentationServices.Properties.RtWPDataQuery.DataQueryState.Configured;
rtdq[1].dataQueryType = OSIsoft.PresentationServices.Properties.RtWPDataQuery.DataQueryType.PIATTRIBUTE;
rtdq[1].ICEParameters = rtdqp1;
rtdq[1].Intervals = 400;
rtdq[1].ResultMode = OSIsoft.RtBaseline.DataAccess.DataResultMode.ModeDataSet;
rtdq[1].ViewName = "PIAttribute";

//----------------------

WebPartExportMode epm = rtWP.ExportMode;
Control ctrl = rtWP.FindControl("Selected Data");
OSIsoft.PresentationServices.Properties.TraceElement tes = new OSIsoft.PresentationServices.Properties.TraceElement();
tes.CanLog = true;
tes.DisplayDigits = -5;
tes.EndTime = "*";
tes.Hidden = false;
tes.IsAsHoc = false;
tes.IsGoodColumnName = "IsGood";
tes.IsStepped = false;
tes.IsStepped2 = -1;
tes.IsXTag = false;
tes.Markers = false;
tes.QueryType = OSIsoft.PresentationServices.Properties.TraceElement.DataQueryType.PI;
tes.SampleInterval = "10m";
tes.ScaleFormat = "Database";
tes.ScaleInverted = false;
tes.ScaleLogarithmic = false;
tes.ScaleMax = "Autorange";
tes.ScaleMin = "Autorange";
tes.StartTime = "*-2h";
tes.TimeColumnName = "UTCTime";
tes.TimeDiff = 0.0;
tes.ValueColumnName = "Value";
tes.VerticalScaleLabel = OSIsoft.PresentationServices.Properties.TraceElement.VERTSCLLBL.None;
tes.XYRetrievalMethod = "Synchronize";
tes.ZoomMax = 0.0;
tes.ZoomMin = 0.0;

OSIsoft.PresentationServices.RtTrend.TrendWebPartProperties wpp = new OSIsoft.PresentationServices.RtTrend.TrendWebPartProperties();
wpp.StartTime = "*-2h";
wpp.EndTime = "*";
wpp.SelectedQuery = 0;
wpp.SelectedTrace = -1;
string[] str = new string[4];
str[0] = "x";
str[1] = "y";
str[2] = "400px";
str[3] = "600px";
wpp.TimeColumns = str;
wpp.TimeZoneOffset = 0;
wpp.updateInterval = 1500;
wpp.updating = "True";

rtWP.RtWPDataQueries = rtdq;

When I try to do Modify Shared Properties It is giving error

"Object not set to an Object Reference" CreateChildControl()" for Tool Part of Trend Web Part.

Can anyone help me how to set data source "Pressure" from server --> "\\\\TEST10\\Aseet_Model\\Congo (Asset 1)\\Location1\\Area1\\Facility1" Programmatically.

Please help.

Thanks in Advance,

Vivek Gupta
vivek31be
#3 Posted : Monday, August 16, 2010 11:25:30 AM
Rank: Newbie
Groups: Member

Joined: 7/7/2010
Posts: 7
Location: New Delhi
Hi Friends,

Think
I have come up with the solution to select Data Source for Trend WebPart programmatically.

It involves editing the xml with following steps:

Step 1) from your Share Point site add PI Trend webpart and modify its shared properties.

Step 2) After Configuring the webpart, you will get a trend webpart which shows you graph for the selected data source after modifying shared properties.

Step 3) Now export the configured webpart into your machine. I will prompt you to save exported file with extension. Save file as <webpart-name>.dwp.

For example:- PI.dwp

Step 4) Open exported file (PI.dwp) in Edit plus (this is an text editor for different type of files). You will get an XML file.

Step 5) Search for "RtWPDataQuery" Tag it is the actual tag which carry the Data Source information.

Note:- while modifying the xml please remove value inside "ClientDataResultKey" tag.

Step 6) Also Modify "TraceElement" tag inside "traceElements" tag. Each Data source of "RtWPDataQuery" has a corresponding "TraceElement".

Step 7) Now you can directly import this modified PI.dwp webpart to sharepoint site OR you can create a webpart which export this PI.dwp as xml and display in sharepoint site. ThumbsUp

Hence you will get a PI Trend Webpart added to your share point site programmatically. If any one is having problem please feel free to ask.

Thanks,
Vivek Gupta
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.