Link Tag Query to SQL Query

I have tag values that are steps or alarm codes in a process and I want to create a cross reference SQL table for these values.  Using BLS, how do you link these tables to have an Xacute query that will return the cross referenced values from the tag?
I appreciate any help that can be provided.
Thanks
Larry

Rick,
One other note I missed in my last e-mail, the Tag Query does not return the TagName as a value in a column but as the column header for the value of the tag.  How is it possible to get this as the value of its own column to be used as a link in the Joiner action.
Current query returns
DateTime                              XV43003     -
(header row)
03/22/2007 03:30:00                     0
03/22/2007 03:31:00                     2
03/22/2007 03:32:00                     8
Preferred method
DateTime                              TagName         Value     -
(header row)
03/22/2007 03:30:00              XV43003              0
03/22/2007 03:31:00              XV43003              2
03/22/2007 03:32:00              XV43003              8
This would give me both the tagname and value to join to the sql table.
Thanks for your help!
Larry

Similar Messages

  • How to pass 100+ tags in a single sql/tag query

    <b>In my current application I have to pass 180+ tags in a single query to retrieve data from iHistorian.
    I want to know how to pass more thatn 100 tags in a single SQL or TAG Query using OLEDB or UDC connectors.
    If anybody has done it in the past ,please share with me and also let me know how to do it</b>

    Currently you can only query a maximum of 128 tags, this is a hard limit and may be changed in future releases of xMII, but < 11.5 (im fairly sure 12 also) all have the limit of 128.
    As for iHistorian with the OLEDB UDS, you can write a query that would return over 128 queries becasue this is an input limitation on the UDSs. (PLEASE DON"T ASK US HOW TO WRITE iHistorian QUERIES... we aren't experts in iHistorian).
    Please note that though you can query over 128 tags, the performance may not be what you expect... This may take a very long time to return.
    Martin

  • Tag Query error when assigning mode in Link Editor

    Hi,
    I am receiving the following error when I run a transaction that contains a Tag query.  In my transaction I have set the tag query mode to be defined by a local property via the link editor.  Then when I execute the transaction I get the following error:
    "[ERROR] [TAG_QUERY_WRITE_TAG]com.sap.xmii.Illuminator.logging.LHException: Mode parameter was not found or is malformed"
    I am on version 12.1.8 Build(43).
    I import the project into MII 12.1.4 Build(53) and the transaction works as expected.
    In the new verson of MII is there a bug utilizing the link editor to set mode?  Or is there a specific way it wants the mode linked. (e.g. specific case)
    Additional details:
    I am trying to use the CurrentWrite mode.  I have tried setting Current mode via the link editor and that isn't working either. 
    Any suggestions?
    Thanks,
    Justin

    Hi Mike,
    Please correct me if I understand the logic incorrectly.  But here is what I am thinking....
    I have configured my transaction to have this flow:
    String_List_To_XML_Sequence --> Repeater_TagValues  -->  TAG_QUERY_WRITE_TAG
    The String_List_To_XML_Sequence would contain String_List_To_XML_Parser_TagValues & String_List_To_XML_Parser_TagNames.
    With this flow the logic would say that I will be running a seperate tag query for each tag value.  So if I have 100 tag values that I want to send, I will run 100 tag queries.  This doesn't seem the most efficient.  Also if this is how you were thinking I would configure the transaction then I could use the following links:
    Target Xpath: TAG_QUERY_WRITE_TAG.TagValue.1
    Expression: String_List_To_XML_Parser_TagValues.Output{/Rowsets/Rowset/Row[#Repeater_TagInput.CurrentItem#]/Item}
    Target Xpath: TAG_QUERY_WRITE_TAG.TagName.1
    Expression: String_List_To_XML_Parser_TagNames.Output{/Rowsets/Rowset/Row[#Repeater_TagInput.CurrentItem#]/Item}
    With this configuration updating 10 tags takes 2 seconds:
    [INFO] Statistics [Load = 35 ms msec, Parse = 35 ms, Execution = 2015 ms, Total = 2067 ms]
    With my old configuration updating 10 tags took 700 ms. (original transaction on 12.1.4 Build (53)
    [INFO] Statistics [Load = 11.137 msec, Parse = 224.113 msec, Execution = 451.78 msec, Total = 736.62 msec]
    Please let me know if I interpreted your thoughts incorrectly.
    If there is a way to utilize only 1 Tag Query, then I am not sure how the transaction flow should be configured.
    Thanks for your time,
    Justin
    Edited by: Justin M Brown on Jul 14, 2011 7:29 PM
    Edited by: Justin M Brown on Jul 14, 2011 7:33 PM

  • Linked server query using Dynamic SQL

    I have a Linked server query that takes forever to run. WHen I hardcode the acct# it runs fast. However I want these acct numbers int he where clause to be generated dynamically. For eg: below is what I need:
    --Get the 11 Loans from this Table A From the FIRST QUERY
    --- Plug those loans numbers in the second query  In the WHERE Clause eg should looks like  where  ACCT in (1,2,3,5)
    DECLARE
    @sSQL varChar(MAX)
    SET @sSQL
    =
    ' SELECT
    [Loan] FROM TableA D
    EXECUTE(@sSQL)
    --2ND QUERY 
    DECLARE
    @sSQL1 varChar(MAX)
    SET @sSQL1
    ='
    SELECT Field1, 
    Field2,
    Field3,
    Field4,
    Field5
       FROM LinkedServer.Dbaname.dbo.TableB a
    where ACCT in ''('''
    +(@sSQL)
    +
    ''')'''--- This needs to look like  where  ACCT in (1,2,3,5)
    select
    @sSQL1

    Ok, so use this.. instead of your first statement.
    DECLARE @sSQL NvarChar(MAX), @output NVARCHAR(100), @ParmDefinition nvarchar(500);
    SET @ParmDefinition = N'@sqlout NVARCHAR(100) OUTPUT'
    SET @sSQL = N'SELECT DISTINCT @sqlout = STUFF((SELECT '',''+CAST(S2.loan AS VARCHAR(100))
    FROM tableA S2
    FOR XML PATH('''')), 1, 1, '''')
    FROM tableA S1'
    EXECUTE sp_executesql @sSQL, @parmdefinition, @sqlout = @output OUTPUT
    and use @output instead of @sSQL in the second statement.
    You can read about STUFF command @
    http://sqlsaga.com/sql-server/how-to-concatenate-rows-into-one-row-using-stuff/.
    Good Luck :)
    Visit www.sqlsaga.com for more t-sql code snippets or BI related how to's.

  • Modes and Methods in Tag Query and SQL Query

    Hi,
    Can someone explain me about the modes available in <b>TAG Query and SQL Query.</b>
    TAG Query has modes such as <b>Current, CurrentWrite, GroupList, History, HistoryEvent, ModeList, Statistics and TagList</b>
    SQL Query i still have doubt on <b>FixedQuery with output , Modelist and TableList</b>
    I also need to know why methods are used?
    Thanks in advance
    Regards
    Muzammil

    I'll try to  explain to the best of my knowledge :
    <u><b>TagQuery</b></u>
    <b>Current</b> : Gives you the current value of the Tag you are reading.
    <b>CurrentWrite</b> : Let you write a Value as the Current Value of the Tag.
    <b>GroupList</b> : Generally Tags are grouped under different groups. Returns you the name of the Groups.
    <b>From the xMII Help Document :</b>
    <b>History</b> : History Mode returns interpolated data.  Interpolation can be accomplished by specifying either the # of rows desired or the retrieval resolution.  If the mode is "History" and a value is provided for the Resolution parameter (which is in seconds), the connector will retrieve evenly-spaced values starting at the beginning of the time interval, up to the maximum # of rows specified in the RowCount parameter.  If no value is provided for the Resolution parameter, the connector will return an evenly-spaced number of values based on the value of the RowCount parameter.
    For example, if the time interval is 1 hour, Resolution is 15, and RowCount is 240, the connector will return evenly spaced values each 15 seconds, up to 240 values (which would span the entire hour).
    If the time interval is 1 hour, Resolution is not provided or is set to zero, and RowCount is 120, the connector would return 120 evenly spaced values, at an effective interval of 30 seconds.
    <b>HistoryEvent Mode</b> : The connector can provide historical values "as they were stored" the database.  This mode provides no interpolation of values.
    <b>Statistics Mode</b> : When retrieving data for statistical calculations, the connector utilizes the same techniques as in the "HistoryEvent"  mode.  It is important to note that the first two returning columns in the HistoryEvent query must be the timestamp and the value, in that order.  The SAP xMII Statistical processor expects that order, or errors will occur.  This ensures precision of statistical measurements, particularly time-weighted average, by using the exact storage time and values from the historical database.  The SAP xMII system provides the statistical calculations.
    <b>Modelist</b> : Basically returns the modes of the Query Available. The Data returned is same as the data in the Modes list in the Quert Template Editor.
    <b>Taglist</b> : Returns all the Tags in the Datasource.
    <u><b>SQL Query</b></u>
    <b>Modelist</b> : Same as above.
    <b>TableList</b> : List of all the tables in the database to which the connector connects.
    Again from SAP xMII Help Documentation :
    <b>FixedQueryWithOutput</b> : This mode is used to execute an Oracle stored procedure or function that returns a REF CURSOR as output.  The position of the REF CURSOR is marked by a "?" in the query.  For example:
    <b>Create a table.</b>
    <i>create table usage (id int, name varchar(50));
    insert into usage (id, name) values (1, 'test1');
    insert into usage (id, name) values (2, 'test2');
    insert into usage (id, name) values (3, 'test3');
    insert into usage (id, name) values (4, 'test4');
    insert into usage (id, name) values (5, 'test5');
    insert into usage (id, name) values (6, 'test6');
    insert into usage (id, name) values (7, 'test7');
    insert into usage (id, name) values (8, 'test8');</i>
    <b>Define the stored procedure.</b>
    <i>DROP PACKAGE foopkg;
    CREATE PACKAGE foopkg IS
      TYPE cursortype is ref cursor;
      PROCEDURE test (mycursor in out cursortype);
    END foopkg;
    CREATE PACKAGE BODY foopkg IS
      PROCEDURE test (mycursor in out cursortype) AS
      BEGIN
         open mycursor for select * from usage;
      END;
    END foopkg;
    </i>
    Define a query template for calling the stored procedure.  Enter the following in the FixedQuery tab:
    <b>call foopkg.test(?)</b>
    This template returns all rows from the Usage table.

  • Tag Query Fatal Error

    I'm wanting to send an email if a tag query fails (Failures could include, can't connect to the data server, can't find tag names, etc).  I'd like to include the reason for the failure in the email message.
    The 'Data Query' help screen for the 'Success' property says 'Evaluates to true if the query executes without a fatal error. If false, the fatal error message can be accessed with the following XPATH: [ActionName].Results{/Rowsets/FatalError}.'
    I can't find a 'Fatal error' entry under Rowsets, only 'DateCreated', 'EndDate', 'StartDate', and 'Version'.  I can find a 'Fatal Error' entry under Rowsets in a SQL query but not a Tag query.  Am I missing something?
    I'm running MII 12.0.4
    Thanks for the help!
    David Macindoe

    You'll see the Rowsets/FatalError syntax here:  /XMII/Illuminator?Server=Simulator&Mode=Foo&Content-Type=text/xml
    An easy trick to help with your linking, just add another name/value pair to the Config Dialog of Mode and Foo, then say yes when it prompts for the sample xml.  This way you'll see it while linking, but don't forget to remove this line when you're done.
    Regards,
    Jeremy

  • I urgently need to find out how to apply behaviour to images in my webpage. Created with dreamweaver and linked J Query stylesheets.

    I have created a web page with a photo gallery of thumbnails that link to bigger images when you hover over them. When the bigger image opens there is an odd shape at the bottom right hand side , that when pressed, will take me back to the home page. But its not the correct sought of button or symbol. I dont know how to set this up properly. I have linked J.Query style sheets. But must have missed something. Can anyone help??? this is my first web page design. It is all done except for this.

    Very sensible advice. However, the second sentence in the following statement is incorrect:
    1.  Make sure that you have updated all recordsets to the latest (CS4) version. Older ones created before the GetSQLValueString function was introduced are vulnerable.
    The GetSQLValueString() function has always existed in Dreamweaver server behavior code. However, versions of this function prior to Dreamweaver 8.0.2 are vulnerable to SQL injection.
    Unfortunately, you can't update older server behaviors simply by deleting the old version of the function and replacing it with one from DW 8.0.2 or later. Other small changes were made in the server behavior code for compatibility with the revised function. PHP server behaviors created prior to DW 8.0.2 need to be deleted and rebuilt. Yes, it's a pain, but far less of a pain than being hacked.

  • Dynamic Tag Query  with dynamic tag name.

    Hi,
    In our implementation we have 10+ users. Each one want to monitor only one production line ( eg. one tag value ) in the dashboard by default when they login.
    I was able to design this requirement CONCEPTUALLY but facing some trouble technically.
    Here is my issue.
    Tagname will be coming from one of the BLS Transaction input parameters (Transaction.Tagname). I am able to build tag query using xMII Tag Query block, able to configure repeater. Here is the spot where I was struck. While assigning tag value to XML Row
    i.e IlluminatorRow_0.Tagvalue = Repeater_0.Output{/Row/AssetUtil1}.
    In the above assignment link it requires a hardcoded tagname. In my case it will be dynamic. I tried different ways like
    1. IlluminatorRow_0.Tagvalue = Repeater_0.Output{/Row/@Transaction.Tagname}.
    2.IlluminatorRow_0.Tagvalue = Repeater_0.Output{/@Transaction.Tagname}.
    But no luck.
    Can someone help in how to do this dynamic tagname assignment.
    Thanks,
    Srinivasa.

    Hi Srinivas,
    another option is to use "Dynamic Links" which from your sample code is what you were trying to do. For this, the proper syntax is:
    Repeater_0.Output{/Row/#Transaction.Tagname#}
    Make sure that the tag name you pass to the historian is the same as the tag name returned by the historian as part of the data set, and make adjustments for that. For example, some historians escape non-alphanumeric characters when they process your request (e.g. passing "abc.def 12-rt" as the tag name can be returned from the historian as "ABC.DEF_12_RT", etc.).
    Hope this helps,
    Sascha

  • Error using a tag query

    We have a tag query that works in our sandbox environment, but not in dev.  I loaded the same JDBC drivers on both systems.
    The project was exported from the sandbox, and imported into dev.
    I have verified the Data Server set up is identical in both environments.  Connection status in both environments is identical - running, same number of connections, etc.
    When I try to run the query on sandbox in workbench, the query returns data.  I get this error on the dev system -
    SQL error has occurred on query java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'tag'.
    Detailed error -
    java.lang.Exception: SQL error has occurred on query [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'publicgrouptag'.
         at com.sap.xmii.Illuminator.gui.workbench.populators.IlluminatorPopulator.get(IlluminatorPopulator.java:114)
         at com.sap.xmii.Illuminator.gui.workbench.populators.TagListPopulator.get(TagListPopulator.java:47)
         at com.sap.xmii.Illuminator.gui.workbench.components.desktop.custom.TagQueryBuilderPanel$6.construct(TagQueryBuilderPanel.java:723)
         at com.sap.lhcommon.gui.ThreadCreator$2.run(ThreadCreator.java:94)
         at java.lang.Thread.run(Unknown Source)
    Any suggestions??

    One of your included JDBC driver archives has a class that matches the path provided by the JDBCDriver setting for the data server (likely the sqljdbc.jar file).
    If you take the JDBCDriver setting: 
    com.microsoft.sqlserver.jdbc.SQLServerDriver
    and replace the periods for sub directories and add a .class on the end you'll have:
    com\microsoft\sqlserver\jdbc\SQLServerDriver.class
    So if you unpacked the jar file you'd find this java class (and the other ones included with the driver).
    Do you get the same error about 'publicgrouptag' and 'tag' objects when you test a tag query request for GroupList mode?  These tables/views would be used by the underlying queries used to populate the tag details tab in the WB.  Do you see these tables or view within the SQL Server?  Does the sa user have appropriate permissions?

  • Passing a tagname from a tag query action to a tag query

    In BLS,  I want to pass a tagname to a tag query . So, I created a "blank" tag query .  Then, using a tag query action, I get a "No tag requested" error while generating the XML sample .
    Please advice, Best regards

    Hi Antonio,
    You must add a tag name either through the Configuration dialog - Parameter Name: TagName.1 - and the name of the tag as the Parameter Value in order to generate the XML sample.   Otherwise, in the Link Editor, you would link a tagname into the tag query parameter TagName.1 - in this case you would answer "No" to the "Generate Sample XML" in the Configuration dialog.
    You could also do both, but, at runtime, what is linked in the Link Editor will overwrite what is configured in the Configuration dialog.  Hope this helps!
    Kind Regards,
    Diana Hoppe
    Edited by: Diana Hoppe on Jun 3, 2011 1:50 PM

  • SAP MII 14.0 Tag Query Findings

    Hi Everyone,
    We has just migrated from 12.2 to 14.0 MII, we did not got any issue in BLS or any Queries. The only issue we faced was the tag Query. So, after migrating from 12.2 to 14.0 we need to re load the Tag query and save it after migration to 14.0 otherwise it will not work as expected.
    Am sharing as many of us may be working for Migration of MII 12.2 to 14.0, this may be useful.

    Where are you querying the data from?
    For example, if you're reading tags from an OSISOFT PI Historian, the "mask" attribute should be tag='AB*'
    Note the single quotes!
    The mask value in PCo queries is dependent on the "source" system masking procedure and format.

  • How do make link between query and UDF

    How do you link a query to your UDF after you created the query and the UDF?
    Also do you have to set the UDF as type "general", and "link"?
    Please take me thru step?

    oh good - a discussion about whether to use "link" or "image" when having an image connected to a product!!!
    Billy and Suda - We had fun with this one some time ago in a project collecting additional data and images for the customer's products on the market.  As we were ramping up the project, we tried both ways of connecting an image to a product and there was a few drawbacks we found with using the UDF type of "General" and "Image":
    1.  The image was placed directly on the UDF portion on the Item Master - they were working in large TIFF (?) formats and the picture just looked horrible.  The approving manager could not tell if the image should be approved for press or not.  When he double-clicked on the image in the UDF portion it brought up another SAP window that wasn't quite crystal clear.
    2.  The image took up so much room on the UDF portion of the Item Master that the data entry personnel had to constantly scroll down to enter the other data points (color, size, branded promo, mixture, etc - there were about 12 fields).  Talk about being ticked!
    3.  While using the "General" and "Link" it addressed those concerns BUT there was one extra enormous advantage with this General/Link method.  When the image was brought up, it opened up the image automatically in a standard picture editor/manager program.  If they liked what they saw, they continued foward with the approval of the image for press runs.  If they did not like the image, they were able to manipulate the image at the moment and then follow through with approval (time saver for sure!).
    I am sure it all boils down to what the customer requirements are, but some other clients I demoed this to wanted to switch immediately after seeing that!  But definitely something to think about if you are planning on connecting an image to a product...
    Oh and she really is correct, Billy - I have never heard of anyone linking a query to a "link" or "image" type...I don' t know how you would even do that as the "link" or "image" selection leads you directly into the attachment and/or storage path and location...
    take care - Zal

  • Tag Query Error

    Hi,
    I am executing a tag query and I keep getting the following error -
    OperationList [ERROR] - Error Message: Pending requests found, current request will be retried at a later date
    OperationList [ERROR] - Error updating
    com.sap.xmii.applet.common.ResultModelException: Error Message: Pending requests found, current request will be retried at a later date
         at com.sap.xmii.applet.common.BaseApplet.getResultModel(BaseApplet.java:1089)
    Can somebody explain what would be the cause of such an error and how to fix it?
    Regards,
    Chanti.

    Actually, they have to be run in isolation because I can't load both projects in the OPC server at the same time. So, I can run the related MII applications only one at a time. But heres something I found in the UDS logs -
    [P:4192, T:5000,       UDS, ] 0x0     HRESULT: 0x80070057 [Invalid at the top level of the document.
    ]     [Connection.cpp @ 1024, CLHOpcDaConnection::FinalGetMetadata]
    [P:4192, T:5000,       UDS, RETHROW] 0x0     Rethrowing exception.     [Connection.cpp @ 1130, CLHOpcDaConnection::FinalGetMetadata]
    [P:4192, T:5000,       UDS, RETHROW] 0x0     Rethrowing exception over COM.     [tagUtil/lhds2Connection.h @ 1427, lhds::LHDSConnectionImpl<class CLHOpcDaConnection>::GetMetadata]
    [P:4192, T:5000,       UDS, ] 0x0     Caught exception over a COM boundry.     [tagUtil/lhds2NamespaceMode.h @ 174, lhds::LHDSTagListModeImpl<class CLHOpcDaDSTagList>::LookUpDescription]
    [P:4192, T:5000,       UDS, HANDLED] 0x0     Handled exception.     [tagUtil/lhds2NamespaceMode.h @ 177, lhds::LHDSTagListModeImpl<class CLHOpcDaDSTagList>::LookUpDescription]
    Does it make sense?

  • Tag query - Rowcount Property

    Hi,
    We are using SAP MII 12.1.5 ( build 83).
    We have been connecting to a PI historian to get data and performing some calculations.
    Since the client gives more important on the accuracy of data, we are using the history event mode.
    ( With history event , we could not get the results as expected)
    While querying a particular tag, the value is not as expected.
    After doing all the testing, We found out the For the particular period PI has some where around 18000 rows. and we are only getting 9999 rows since we have specified this in the tag query row count.
    In the transaction I tried to increase the rowcount to 20000. It is not working.
    The maximum count is 10000. After that the query gives unknown error Java LH exception.
    Is there a limitation on the rowcount property?
    If we fix the row count for a certain limit and the query returns more than those number of rows,  how to get all data?
    I am sure handling these huge number of rows is not a very good thing to do. But the algorithm to calculate the end result requires each and every data as registered in PI.
    Any input is appreciated.
    Thanks in Advance,
    Kishore kumar P S

    Hi Mike,
    We have initially told about the performance issues if we go with this approach.
    But once we have shown the demo last week, they agreed with the modified approach.
    Now we are using the Statistics with TOT.  Still the totalizer value is not taking effect.
    As I know from the help docs, the totalizer factor is used to change the from one unit to another unit.
    the help Doc says
    "The area under the curve (effectively a "totalizer" value) can be calculated by multiplying the time-weighted average by the width of the time interval in seconds.  However, quite often, the instrument or measurement is in different units (perhaps gallons per minute versus per second), and the TotalizerFactor parameter can be used to perform the correction."
    But there is no effect on the totalizer value. There is one more point in totalizer value is depend upon the connector. We are using the UDC connector. Currently I am not getting anything on this connector type.
    Any inputs will be appreciated.
    Thanks & Regards,
    Kishore kumar P S

  • Tag Query - History 12.0.2

    Has anyone run into a problem with using the History mode of a Tag Query?
    I am connected to an IP21 data source.  I can get HistoryEvent data and Current data back, but when I run in History mode, I get a blank HTML.  Running in XML mode, I receive the following back:
    <?xml version="1.0" encoding="UTF-8" ?>
      <Rowsets DateCreated="2008-02-25T13:17:36" EndDate="2008-02-25T13:17:28" StartDate="2008-02-25T12:17:28" Version="12.0.2 Build(88)" />
    I have an 11.5 instance and the same tag and data source does return the expected values, so the problem does not appear to be in the data source.
    I am going to initiate a ticket for this.
    Thanks,
    Mike

    Never mind.  Turns out it was pointing to incorrectly configured local data server.  Configuration fixed and then it works fine.

Maybe you are looking for

  • Rated song in my iphone/ipad does not show in itune

    hello i had rated som song as one star in my iphone, so when i connect to itunes, the rating should show, [when i select the music of my iphone in itunes] i used to have it in old release but now i dont know why does not show . i even made smart list

  • Can I set the subject line to wrap around in folder pane? If so, how?

    I have my view set to Vertical - Folder pane and Preview pane side-by-side. I like to be able to display more of the subject in folder pane without enlarging the folder pane's width of reducing the width of the preview pane. Is it possible to make th

  • Blue Screen - NO Application Enhancer

    Ok so I am seeing the blue screen - tried looking through all the posts including the Apple Support document. However I don't have the APE installed - never did. Is there anything else you guys know about that causes this? Is my only option the archi

  • Disableing nodes in JTree

    Hi All, is it possible to disable the nodes in a JTree. i.e. Grey them out, so user is not able to select. thanks

  • What is getResources ?

    public ActionForward execute(ActionMapping mapping,                                  ActionForm form,                                  HttpServletRequest request,                                  HttpServletResponse response)     throws Exception {