Thursday, August 19, 2021

SharePoint App reg new ids screen

 The app identifier has been successfully created.

Client Id: c6551e2b-1166-48d4-b6e1-a1ae25d8309f
Client Secret: iGgkwDnLVDxgPY73IGBk6f+0yrSx+XGvEOkYnMVgHMk=
Title: AGS.BIMCommunication
App Domain: o365qaappweb.amat.com
Redirect URI: https://o365qaappweb.amat.com/BIMCommunication

Tuesday, June 8, 2021

Power App error: the app you trying to open was saved with newer version of powerapps and cannot be opened..

1. Create a new app with new  version, after publish to SharePoint, customized it again take the URL from, while editing like below:

==============================

https://us.create.powerapps.com/studio/?action=sp-edit-formdata&app-id=e77ea2fa-0bdd-477b-9b08-815a772c20ad&correlation-id=50e36e54-80f3-43fb-a680-2c7239d0926e&redirect-reason=WebAuth.NewInstanceRedirect&environment-name=Default-709c2643-b1a9-4415-ad0f-521cfa6ba3f5&environment-update-cadence=Frequent

=================================


2. Now open your App from from form settings option:

Modify form in PowerApps:

Copy the URL while editing,  and the version like blow in URL highlighted

https://us.create.powerapps.com/v3.21054.31.188965150/studio/?action=sp-edit-formdata&app-id=2609a1de-5a2b-4087-b256-0cafc9b1e6d0&correlation-id=72ff7fe3-f7df-46ff-8825-f3766ca22a62&redirect-reason=WebAuth.NewInstanceRedirect&environment-name=Default-709c2643-b1a9-4415-ad0f-521cfa6ba3f5&environment-update-cadence=Frequent

and now open you app. it will work.






Power Apps: App on start collection (Over coming the 2000 records limitation from any db in power app)

 

1. first Create collection on onStart of App and click on  runonstart option from 3 dots.

# sharepoint list have column batchid for filtering purpose

=====================================================

Concurrent(ClearCollect(KT1,Filter(TKM_V_Lookup_ExcelData,BatchId=10)),

ClearCollect(KT2,Filter(TKM_V_Lookup_ExcelData,BatchId=15)),

ClearCollect(KT3,Filter(TKM_V_Lookup_ExcelData,BatchId=20)));

ClearCollect(KITData,KT1,KT2,KT3);

=====================================================

2. Bind dropdown on items: KITData collection  (showing KIT Number)

     Distinct(KITData,KIT_NUMBER).Result

3. if you have cascading ddl then, on Items:   (showing Contract Number)

Filter(KITData,KIT_NUMBER=ComboBox1.Selected.Result)

4. Bind other text fields on default:

-------------------------------------------------------

If( SharePointForm1.Mode = FormMode.New || SharePointForm1.Mode = FormMode.Edit,

    ( If( (!IsBlank(ComboBox2.SelectedItems)),  Concat( ComboBox2.SelectedItems,

            'CONTRACT_ NUMBER'   ),  Parent.Default ) ),    Parent.Default)

-------------------------------------------------


Monday, February 1, 2021

Web API Example with File upload

 <html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title></title>

    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $("#getbtn").click(function () {

                GetRequest();

            });

        });


        function GetRequest() {


            var ibObj = {

                RequestorName: $("#txtRequestor").val(),

                RequestorEmail: $("#txtRequestorEmail").val(),

                RequestTitle: $("#txtTitle").val(),

                Description: $("#txtDesc").val(),

                RequestType: $("#ddlRequestType").val(),

                RequestPriority: $("#ddlReqPriorty").val(),

                ExpCompleteDate: $("#txtReqCompletionDate").val(),

                GISTicketNo: $("#txtgis").val(),

                FileName:fileName,

                FileByteArray: fileByteArray

            }


            var obj = JSON.stringify(ibObj);


            $.ajax({

                url: "api/ibase/IbaseEntity/",

                type: "POST",

                data: obj,

                dataType: "json",

                contentType: "application/json; charset=utf-8",

                success: function (data) {

                    $("#ibase").text(data);                 

                },

                error: function (error) {

                    alert(JSON.stringify(error));

                }

            });


        }


        var fileByteArray = []; var fileName;

        function getFilebytes() {

            var file = document.getElementById("fileUpload").files[0];

            fileName = file.name;

            let fileReader = new FileReader();


            fileReader.readAsArrayBuffer(file);

            fileReader.onload = function (ev) {

                const array = new Uint8Array(ev.target.result);

                for (let i = 0; i < array.length; i++) {

                    fileByteArray.push(array[i]);

                }

                console.log(fileByteArray); // here it is

            }

        }

    </script>

    <style>

        table {

            height: 200px;

        }

    </style>

</head>

<body>


    <div id="ibase" style="color:green"></div><br />

    <div>

        <table>

            <tr>

                <td>Request Title:</td>

                <td><input id="txtTitle" type="text" /></td>

            </tr>

            <tr>

                <td>Request Type:</td>

                <td>

                    <select name="ddlRequestType" id="ddlRequestType" class="form-control">

                        <option value="--Select--">--Select--</option>

                        <option value="Request New Field">Request New Field</option>

                        <option value="Add Assemblies">Add Assemblies</option>

                        <option value="Data Cleanup">Data Cleanup</option>

                        <option value="Other">Other</option>

                    </select>

                </td>

            </tr>

            <tr>

                <td>Request Priority:</td>

                <td>

                    <select name="ddlReqPriorty" id="ddlReqPriorty" class="form-control">

                        <option value="--Select--">--Select--</option>

                        <option value="P1:Critical">P1:Critical</option>

                        <option value="P2:High">P2:High</option>

                        <option value="P3:Medium">P3:Medium</option>

                        <option value="P4:Low">P4:Low</option>

                    </select>

                </td>

            </tr>

            <tr>

                <td>Expected Completion Date:</td>

                <td><input id="txtReqCompletionDate" type="text" value="2021-01-27" /></td>

            </tr>

            <tr>

                <td>Description:</td>

                <td><input id="txtDesc" type="text" value="desc" /></td>


            </tr>

            <tr>

                <td>GIS Ticket No:</td>

                <td><input id="txtgis" type="text" value="12345" /></td>


            </tr>

            <tr>

                <td>RequestorName</td>

                <td><input id="txtRequestor" type="text" value="Navneet Sharma --CNTR" /></td>


            </tr>

            <tr>

                <td>RequestorEmail</td>

                <td><input id="txtRequestorEmail" typetext value="navneet_sharma@contractor.amat.com" /></td>


            </tr>

            <tr>

                <td>File Upload</td>

                <td><input id="fileUpload" type="file" onchange="getFilebytes()" /></td>


            </tr>

            <tr>               

                <td colspan="2"><br /><input id="getbtn" type="button" value="Save" /></td>

            </tr>

        </table>

       

        <br />

       

       

    </div>



</body>

</html>

Monday, January 4, 2021

Web API formatters

 Web API returning default JSON with proper indentation

------------------------------------------------------------------------

 public static class WebApiConfig

    {

        public static void Register(HttpConfiguration config)

        {

            // Web API configuration and services

            // Configure Web API to use only bearer token authentication.

            config.SuppressDefaultHostAuthentication();

            config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));


            // Web API routes

            config.MapHttpAttributeRoutes();


            config.Routes.MapHttpRoute(

                name: "DefaultApi",

                routeTemplate: "api/{controller}/{id}",

                defaults: new { id = RouteParameter.Optional }

            );

            config.Formatters.Remove(config.Formatters.XmlFormatter);

            config.Formatters.JsonFormatter.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;

            config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

        }

    }

Tuesday, December 15, 2020

JQ Grid Examples


JQ Grid Examples:

=============


 http://www.ok-soft-gmbh.com/jqGrid/ActionButtons.htm

http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGridWithInlineEditingOnEnter.htm

http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGridWithInlineEditingAndHide.htm

https://www.ok-soft-gmbh.com/jqGrid/OK/performane-13-5000-25-free-jqgrid.htm

http://www.ok-soft-gmbh.com/jqGrid/SubgridWithLocalGrid.htm

http://www.ok-soft-gmbh.com/jqGrid/OK/LocalAdjacencyTree-expandCallapsAll.htm

http://www.ok-soft-gmbh.com/jqGrid/OK/performane-1000-free-grid-groupingAll.htm