Thursday, September 17, 2015

How to show MQL Data using classic ASP

Follow These 3 Steps to Retrieving MQL Data Using Classic ASP and MATRIXONE Tool



Step 1: Create object of ServerXMLHTTP 6.0x

          dim xmlhttp,urlLogin,PartNO,revision,holdcontent,InitialPoint,FinalPoint,Line
          dim arrFinaldata(0)
          set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP.6.0") 
          xmlhttp.setTimeouts 30000, 60000, 60000, 18000

Step 2: Login into MQL System

          urlLogin = "http://Mwebcorp123.am.mot-mobility.com:5411/ematrix/servlet/login?                                                 login_name=princy&login_password=princy05"
          xmlhttp.Open "POST", urlLogin, False
          xmlhttp.send ""

Step 3: Write MQL query and get responseText of XMLHTTP

             urlECR = "http://Mwebcorp123.am.mot-mobility.com/ematrix/common/emxRunMQL.jsp?mqlCommand=expand bus 'part' """& PartNO &""" """& revision &""" from rel 'Manufacturer Equivalent' select bus to[Manufacturer Equivalent].to.attribute[W18 Part Status].value dump |;"

           xmlhttp.Open "POST", urlECR, False                                                                              
           xmlhttp.send ""
   holdcontent = xmlhttp.responseText

         If InStr(1, holdcontent, "results") > 0 Then
            InitialPoint = InStr(1, holdcontent, "results") + 9
            FinalPoint = InStr(1, holdcontent, "</textarea>")
            Line = Mid(holdcontent, InitialPoint, FinalPoint - InitialPoint)
               if len(line)>0 then

                 'put logic here like split data into array
                      
                      arrFinaldata = split(Line," ")

              end if
       end if

Tuesday, August 11, 2015

How to work with vaults in MQL

It is a grouping of similar objects within the Matrix database, as well as a storage location for metadata which identifies those objects. For Example, In an engineering environment, a vault might contain all objects related to a particular project or family of products.

Two types of vaults:

1)  Business object vault
2)  An Administration vault


Business Object Vault
                    It's used to organize business objects within your database. All vaults contain a complete set of Matrix definitions. These definitions identify the characteristics of items such as persons, roles, types, formats, etc. When you make changes to a definition (such as add, modify, or delete), all definition copies must be updated to reflect the change. This update of the vaults occurs simultaneously if all the copies are available. If any of the copies are not available (a vault is not available), you cannot alter the definitions. 

An Administration Vault
                   It's used for administrative purposes only and serves as the master definition vault. It is created automatically when Matrix is installed on your system. Unlike other vaults, the Administration vault is not listed among the available vaults when a person uses the Vault Chooser to specify a vault when setting context, performing queries, or creating new objects in Matrix Navigator or Web Navigator. The Administration vault is used for definitions only. You cannot use it for storing business objects.

NOTE: You must be a System Administrator to access vaults.

Syntax for creating vault
      
            add vault NAME {Add item}.

You can also define the various clauses while creating vault like description, icon, indexspace, table space, server, interface, file and etc.   

We can also modify, clearing and deleting vault with the help of modify, clearing and modify statement.

   1)  modify vault NAME {Modify item}
   2)  delete vault NAME;
   3)  clear vault NAME [revision] [relationship] [full] [size number] 

NAME is the name of the vault you want to clear.

NUMBER is the size of the transaction before a database commit.The size clause only applies when any of the other optional clauses are included. 

Once a vault has been established and used, you should NOT use the Clear Vault statement. In addition, you should not use it when users are online.






Saturday, May 23, 2015

MQL- Transaction

Transaction involves accessing the database or producing a change in the database. All MQL Statement involve transactions.

Two Types of MQL Transaction

1) Implicit Transaction
2) Explicit Transaction

IMPLICIT TRANSACTION

           When ever you enter MQL Statement, the transaction is started and, if the statement is valid, the transaction is committed. Ex-

add person mohan

As soon as you enter the statement, Matrix starts the transaction to define a person named mohan. If that person is already defined, the statement is invalid and the transaction aborts—the statement is not processed and the database remains unchanged. If the person is not already defined, Matrix is committed to (the completion of) the transaction of adding a new person. Once a transaction is committed, the statement is fully processed and it cannot be undone. In this case, mohan would be added to the database.

 EXPLICIT TRANSACTION

  Some MQL statements enable you to explicitly commit, abort and start transaction.Ex-

                          abort transaction [NAME];
                          commit transaction;
                          print transaction;
                          start transaction [read];
                          set transaction wait|nowait|savepoint [NAME];
 


You can also update the transaction. Ex- 

                        start transaction update;
                        add businessobject Part “001820” 0
                        policy Part
                        description “Part of mobile for xyz model”;
                        checkin businessobject Part “001820” 0 PB8XCVR;
                        add businessobject Part ”001821” 0    
                        policy Drawing
                        description “Substitute Part of 001820”;
                        checkin businessobject Drawing ”001821” 0 PB8XCVR;
                        commit transaction;

This transaction is started and the current state of the database is saved. The add businessobject statements create businessobjects, and the checkin businessobject statements add the files. When the commit transaction statement is processed, MQL examines all the statements that it processed since the start transaction. If no error are detected, all changes made by the statements are permanently made to the database. .



Friday, May 8, 2015

MQL Statement

MQL Statement consists of a keyword, clauses and values. MQL Statements follow their own set of protocol and conventions as in any programming languages(SQL, MySql). Mql Statement may or may not contain clauses. All clauses begin with keyword and separated with a space, tab or carriage return.

Example of MQL Statement with clauses:

       add attribute "modifiedDate"
              description "this is the modified date of the product"
              type datetime

When we are using MQL, there are two important MQL Statement: Quit and Help.

QUIT Statement

             The quit statement exits the matrix command interface and returns control to the OS.In simple word, if we want to terminate our MQL session, just enter:

             quit [integer];

HELP Statement

              The help statement is available for various MQL statement categories. If you do not know which category you want or you want to get a listing of the entire contents of the help file,
enter:

             help all;

Wednesday, April 8, 2015

What is MQL?

MQL is the Matrix Query Language. Just like SQL, MQL consists of a set of statements that help the administrator set up and test a Matrix database quickly and efficiently.  Basically MQL is a tool for building the matrix database. we can also use MQL to add information to the existing database, and extract information.

Example of MQL Query:

temp query bus 'part' "SOGO1103" * where 'Modified >= 3/6/2015 10:11:37 PM' select Modified from dump |;

MQL Modes:  Interactive, Script and Tcl


 Interactive Mode:-

        In this mode, we type one MQL Satement  at a time. As each statement is entered, our matrix processes it. MQL is not intended to be an end-user presentation/viewing tool, and as a consequence there are cases where some non-ASCII character sets (eg.some Japanese characters) will  have characters that do not display properly in certain cases, such as when a history record  is printed to the console in interactive mode. This is due to low-level handling of the byte  code when attempting to display. However, the data is intact when retrieved in any  programmatic way, such as:

• Retrieving data into a tcl variable: set var sOut [mql print bus T N R select history]
• Retrieving data from a java program via ADK calls.
• Writing data into a file: print bus T N R select history output d:/temp/TNR_History.txt;

The interactive mode is useful if you have only a few commands to enter or want  extensive freedom and flexibility when entering commands. However, interactive mode is  very inefficient if you are building large databases or want to input large amounts of  information. For this reason, Matrix enables you to use MQL in a script mode. When working in the script (or batch) mode, you use a text editor to build a set of MQL  statements. These statements are contained in an external file, called a script, that can be  sent to the Matrix command interface. A script passes a batch of MQL statements to the  Matrix command interface for processing. The interface then reads the script, line by line,  and processes the statements just a sit would in the interactive mode.

Script Mode:-

       Working in script mode has many advantages, particularly when you are first building a database. Some examples of advantages are:

• You have a written record of all your definitions and assignments. This enables you to  review what you have done and make changes easily while you are testing the  database. When you are first building the database, you may experiment with  different definitions to see which one works best for your application. A written  record saves time and aggravation since you do not have to print definitions when  there is a question.

• You can use text editor features to duplicate and modify similar definitions and  assignments. Rather than entering every statement, you can copy and modify only the  values that must change. This enables you to build large and complicated databases  quickly

• Testing and debugging the database is simplified. MQL databases can be wiped clean  so that you can resubmit and reprocess scripts. This means that you can maintain  large sections of the MQL statements while easily changing other sections. Rather  than entering statements to modify the database, you can simply edit the script. If you  are dissatisfied with any portion of the built database, you can change that portion of  the script without eliminating the work you did on other portions. (If you were  working interactively, you would have to track what had and had not changed.) Since  the script contains the entire database definition and its assignments, there is no  question as to what was or was not entered.

Tcl Mode:-

      With Tcl (tool command language) embedded in MQL, common programming features such as variables, flow control, condition testing, and procedures are available for use with Matrix. The Tk toolkit is also included. Tcl and Tk are widely available and documented. The information in this section is simply an overview of functionality.


Monday, November 3, 2014

Implement Facebook, Likes, Shares and Comment In ASP.NET

Introduction:

This Demo explains how to implement Facebook likes and shares concepts for your website


Step 1: Copy the below code into <head> tag in html page.
        
        (function(d, s, id) { 
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=1509435125976810&version=v2.0";
        fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
        
Step 2: Create a page in facebook, like -- https://www.facebook.com/mtvroadies

Step 3:Copy the below code into into <body> tag in html page.

<div class="fb-like" data-href="https://www.facebook.com/mtvroadies
data-layout="standard" data-action="like" data-show-faces="true" data-share="true">
</div>

Example: