24 Replies Latest reply on Feb 8, 2013 9:05 AM by Gregor

    Manual data entry in InfoPath?

    Asle Frantzen

      I have an upcoming task where I'm going to set up an InfoPath (MS Office 2007) form to write data to PI.

       

      Anyone got some experience with that?

       

       

       

      I haven't got any experience at all with InfoPath, and I'm also not shure which technology is the best to go for here. My initial thoughts point in the direction of PI OLEDB, maybe I can solve this without any custom coding (?).

        • Re: Manual data entry in InfoPath?
          merighm

          There is a nice document in the vCampus Library. Look for "View and Edit PI Point Data with InfoPath" under "OSIsoft - Microsoft Accelerators".

           

          Moh&

            • Re: Manual data entry in InfoPath?
              I couldn't have said better: see the Accelerator on the Library :) On a side note, I would like to invite you and the whole community to provide feedback on the Accelerators, as well as suggestions for new ones. The PI WebParts team and the people at the OSIsoft|Microsoft Alliance regularly visit vCampus and I'm sure they're looking forward to reading about your needs.
                • Re: Manual data entry in InfoPath?
                  Asle Frantzen

                  Thanks guys, that'll probably be enough to get me started!

                   

                  Your sidenote is noted, Steve!

                   

                   

                   

                  Btw - the search function for vCampus (top right corner) didn't return any results for "infopath". It seems like it only searches through the forums. IMO it should search through the entire site, so when I search for "infopath" (before posting in the forums) that document would show :)

                    • Re: Manual data entry in InfoPath?

                      Asle Frantzen @ Amitec

                      the search function for vCampus (top right corner) didn't return any results for "infopath"

                       

                      Thanks for pointing this out - I'll bring this to the developers' attention and see to what extent we do/can index what's in the Library.

                        • Re: Manual data entry in InfoPath?
                          Asle Frantzen

                          I have some feedback after fiddling around in Infopath for a while.

                           

                          When hitting the Submit Data button in Infopath, it seems it only wants to send 1 piece of data to the webservice. Since I'm not too familiar with using InfoPath, I can't tell if the setup is wrong there - or if it is the limitations in the PiWebService I set up as part of the walk through in the Accelerator document, which hinder me.

                           

                          What I'd like to make, is a manual data entry form much like the OSIDN Manual Data Entry Excel sheet which is out there. Set up with 8 pre-defined tags, and a textbox for entering data behind each of them.

                           

                          And the reason I want to have this in InfoPath, is that my customers organization heavily integrate InfoPath in every computer they have. So with users familiar with InfoPath, the integration of PI and Manual Data Entry would be just a bit smoother than if we should introduce Excel for all users :)

                            • Re: Manual data entry in InfoPath?

                              Thanks for the feedback Asle! I forwarded your comments to the team who's working on SharePoint/InfoPath accelerators.

                                • Re: Manual data entry in InfoPath?
                                  jspainhower

                                  The "1 piece of data" limitation that you are seeing is simply that of the OBA example implementation. InfoPath forms should be able to submit multiple fields of data via a single XML document. Likewise, web services can be written to consume multiple fields of data (within an XML document). I can see no technical limitation that would prevent you from creating the solution that you have described.

                                   

                                  Below is an edited version of the "insertEvent" web service method from the OBA documentation that you can add to your test asmx file. This new method, called "insertEvents" consumes two values and writes the first value to SINUSOID and the second value to SINUSOIDU (both using the current time for the "time" value). I imagine there are more elegant ways to implement this code, but for the sake of demonstration this should do.

                                   

                                  After adding this new method to the asmx file, create an InfoPath form template that submits data based on the asmx web service. Then, modify the submit data connection (via Manage Data Connections...) and map your tns:Val1 and tns:Val2 parameters to "/dfs:myFields/dfs:dataFields/tns:insertEvents/tns:Val1" and "/dfs:myFields/dfs:dataFields/tns:insertEvents/tns:Val2", respectively. Lastly, drag the insertEvents group from the Data Source section to your form as "Controls in Layout Table" (I've experienced some erratic behavior when adding groups as a Section although I've been unable to determine the cause of the behavior).

                                   

                                  You should then be able to preview and save two different tag values at the same time. I realize that this is just a crude example but hopefully it can help get you started.

                                  [WebMethod (Description="Inserts events into the PI archive for multiple specified PI tags.",BufferResponse=true)]
                                  public String insertEvents (string Val1, string Val2) 
                                  {

                                      DateTime now = DateTime.Now;
                                      string strConn = @"Provider=PIOLEDB.1;Data Source=[ServerName];Initial Catalog=piarchive;User ID=;PASSWORD=;Support PI Wildcards=TRUE;sessionid=-1";
                                      string strSQL  = "";

                                      strSQL  = @"INSERT INTO piarchive..picomp2 ([tag], [time], [value]) VALUES('SINUSOID', '" + now + "', " + Val1 + ")";

                                      try
                                      {
                                          OleDbConnection dbConnection = new OleDbConnection(strConn);
                                          OleDbCommand objCommand = new OleDbCommand(strSQL, dbConnection);

                                          dbConnection.Open();
                                          objCommand.ExecuteNonQuery();

                                          objCommand.CommandText  = @"INSERT INTO piarchive..picomp2 ([tag], [time], [value]) VALUES('SINUSOIDU', '" + now + "', " + Val2 + ")";
                                          objCommand.ExecuteNonQuery();

                                          dbConnection.Close();
                                          dbConnection = null;

                                          return "Operation completed successfully";
                                      }

                                      catch(Exception err)
                                      {
                                          EventLog.WriteEntry("Application", "\n\n" + "Source: " + err.Source + "\n\n" + "Message: " + err.Message, EventLogEntryType.Error);
                                          return "Error: " + err.Message;
                                       }
                                  }

                                    • Re: Manual data entry in InfoPath?
                                      Asle Frantzen

                                      Thanks for the reply!

                                       

                                      I actually made something similar earlier today. But as an explanation to my previous post, one explicit problem I experienced, was this:

                                       

                                      After getting the sinusoid-values for the last 10 hours, and then adding two new rows at the top of the table - with different values and slightly different timestamps - only the topmost row of data was sent to the webservice. While this isn't necessarily a required functionality of my form, it kind of demotivated me to continue.

                                       

                                      What I actually need, is just a simple form with 8-10 predefined tags + textboxes for the new values, and a dropdown box with 24 entries - each describing the hours of the day (24h format). So it shouldn't be too hard.

                                       

                                      Thanks again!

                                    • Re: Manual data entry in InfoPath?
                                      davidwsmith@bhi

                                      This document says to create a virtual directory under default. However since I am running SharePoint the default is not running. I am wondering if I create the virtual directory under  SharePoint - 80. In the past I created a service and converted to SharePoint service uning the following cookbook. If I am understanding this correctly this is a service that co exist with SharePoint and the ecookbook below is unnecessary.

                                       

                                      http://www.walisystems.com/articles/SPS/uplservice/v1/creating%20a%20cutom%20web%20service.htm

                                       

                                       

                                        • Re: Manual data entry in InfoPath?
                                          hanyong

                                          Hi David,

                                           

                                          As far as I know, it is possible to have a web service that co-exist with Sharepoint. Like you say, you can create a virtual directory under Sharepoint - 80 for it. If you are using  Microsoft Windows SharePoint Services or Microsoft Office SharePoint Portal Server 2003, then you need to configure Sharepoint to exclude the path, refer to this page: http://support.microsoft.com/kb/828810.

                                            • Re: Manual data entry in InfoPath?

                                              In the case of web services, it is sometimes not enough to just exclude the path from SharePoint, you might have to configure the web application on its own port number (i.e. not 80). Also verify that the application pool you set up for this web service runs under a Process ID that is different from the Process ID used for SharePoint and SharePoint-based applications (e.g. PI WebParts).

                                                • Re: Manual data entry in InfoPath?
                                                  davidwsmith@bhi

                                                  I implemented all of you suggestions; new web on port 82 , new virtual directory, new web.config , new application pool and linked the application to this pool. I made sure process ID was different. I still didn't get results back. After reviewing logs on PI server  it appears there was some sort of trust/login problem. I already have a trust between my SharePoint server and Pi Server. I went ahead and turned off the security for Explict login, Explict login for piadmin, and blank passwd not allowed. This worked - the GET returned the values. I have been using the IE on the SharePoint server and now I decided to test from my laptop IE. I clicked getEvents and i don't get the input form. Instead it says (see below.) Where is this coming from?

                                                  Test

                                                  The test form is only available for requests from the local machine.

                                                   

                                                  Additional Note

                                                   

                                                  I was able to connect the InfoPath with the sevice and everything works as advertise. It does not work in the browser mode. It complains about the data source. So I can upload the document but not publish it.

                                                    • Re: Manual data entry in InfoPath?

                                                      Are you still in IP'07 or is this in IP'2010?  And, do you have SP Admin privileges to publish?

                                                        • Re: Manual data entry in InfoPath?
                                                          davidwsmith@bhi

                                                          I am using IP 07. When I publish it say the form published successfully. When I use the option to open in browser I get the errror "An error occurred accessing a data source." An entry has been added to the Windows event log of the server.Log ID:6932  " When I go to the library the form/template is not there. It did create the library itself  so I should have SP admin unless there is an explict privileges to publish. The trust is set to domain. I use the IP to verify it is browser compatible. In addtion, I use the admin web to upload the form and verify it and use as Administrator-approved form.  If I just upload the form I can use IP without problems. However our POC calls for the browser version.

                                                            • Re: Manual data entry in InfoPath?

                                                              We have a 2010 environment, so it will be a few days to get to a '07 environment and comment on your findings...

                                                               

                                                              I also recall that you need to check an option in Site Settings to Open in Browser for IP forms to open in browser after you publish

                                                                • Re: Manual data entry in InfoPath?
                                                                  davidwsmith@bhi

                                                                  I built a DCL in case there was double hop issue involved. Now when I publish it says the form template could not be browser-enable. I have not been able to find anything in the SharePoint log files.  Forms service is active.  Can you add the web.conf file that went with this example. Do you use Kereros or NTLM authentication?

                                                                    • Re: Manual data entry in InfoPath?
                                                                      rmeyskens

                                                                      I am just trying to walk throught the accelerator document. In my environment I have a web server and a PI server. I created the asmx file, adn all that jazz. However when I run the test the service is trying to connect via the piadmin explicit trust, which is disabled in our security policy. I have created a trust from the web server to the PI server and the web service does not seem to attempt to use this trust. Any ideas what I need to change? My end goal would be to use double hop so that each user is authenticated on whether they are able to insert new values into PI using an infopath form.

                                                                        • Re: Manual data entry in InfoPath?

                                                                          Hello Randy,

                                                                           

                                                                          I am not sure about authentication via double-hop but when dealing with trust issues, please review the PI Server log for messages from source pibasess. These messages contain the information transferred with the connection attempt and are those you can use with your trust(s).

                                                                            • Re: Manual data entry in InfoPath?
                                                                              rmeyskens

                                                                              Thanks I did check that. It is only trying to use the explicit login. Even when I create a trust it does not seem to work. I would like to see if use integrated security. If I use the PIOLEDB msc plugin from the webserver using integrated security it works fine. So I am assuming it is something in my connection string, or the identiy that the app pool runs under....just seeing if anyone had any quick fixes.

                                                                                • Re: Manual data entry in InfoPath?
                                                                                  rmeyskens

                                                                                  Okay, I was able to get the connection string working. I used a udl file to get me the correct connection string.

                                                                                   

                                                                                  Has anyone got double hop to work with this PIGetEvents.asmx file? I created a service account and set the app pool to use this account, created an spn. When I go to do an insert event test, the test is only using the app pool account to try and insert (which does not have privileges to insert). What I would like to see is that it uses the user account of who is logged in to insert the data. So if they do not have permissions then the data cannot be inserted.

                                                                                   

                                                                                  The other way around this issues is to grant the app pool account access to insert values and use SharePoint security to restrict who can get to the InfoPath form, but I would rather not rely in SharePoint security to decide who can/cannot insert data into PI.

                                                                                    • Re: Manual data entry in InfoPath?

                                                                                      Hello Randy,

                                                                                       

                                                                                      I am wondering if it may make sense moving this thread to PI SQL Data Access - OLEDB/JDBC Forum since I don't see it is related to ProcessBook / ActiveView and Microsoft Office Development. Am I missing something?

                                                                                       

                                                                                      To answer your previous question regarding how to ask for a trusted connection with PI OLEDB Provider, the connection string must contain "Integrated Security = SSPI". The same works when Windows Integrated Security (WIS) is required.

                                                                                       

                                                                                      With regards to your double-hop question, my knowledge is that what you are trying to achieve here will not work. The w3wp.exe process will use the account you've specified with the application pool. I am afraid you will have to manage access on the SharePoint level.

                                                                                        • Re: Manual data entry in InfoPath?
                                                                                          mhamel

                                                                                          @Randy: You need to configure the <identity> tag within the web.config file (as shown below) of your web service to accept impersonation (or delegation). The Web Service would have to execute another account capable of impersonating or delegating. Delegation would imply some changes at the domain level to reach out your PI Server for example. The application pool running your ASMX Web Service would need to execute as NT Authority\Network Service (this account has natural privilege to impersonate) or any domain account capable of delegating security. Also, you will need to activate the Web Server for delegation in Active Directory.

                                                                                           

                                                                                           1732.20500-_2D00_-sc1.png 

                                                                                           

                                                                                           I hope this helped.