Search

Tuesday, November 30, 2010

Excel - Trim Last 5 Characters

Excel Formula to capture and trim the last 5 characters of an adjacent Field that contains a string value

=RIGHT(C37,LEN(C37)-FIND("*",SUBSTITUTE(C37," ","*",LEN(C37)-LEN(SUBSTITUTE(C37," ","")))))

Friday, October 01, 2010

JScript to Get Base Form Library URL

//GET Base URL of an Originating Form Library (WITHOUT a trailing /)

strUri = XDocument.Solution.URI;
strPath = strUri.substring(0, strUri.indexOf("Forms") - 1);
XDocument.UI.Alert(strPath)

//GET Base URL of an Originating Form Library (WITH a trailing /)
strUri = XDocument.Solution.URI;
strPath = strUri.substring(0, strUri.indexOf("Forms"));
XDocument.UI.Alert(strPath)

Monday, March 01, 2010

JScript Case / Switch Example


function msoxd_my_Approval_Status::OnAfterChange(eventObj)
{
// Write code here to restore the global state.

        if (eventObj.IsUndoRedo)
                {
                        // An undo or redo operation has occurred and the DOM is read-only.
                        return;
                }

var StatusChoice = XDocument.DOM.selectSingleNode("/my:myFields/my:InputData/my:Approval_Status").text

        switch (StatusChoice)
                {
                        case "Approved":
                        XDocument.DOM.selectSingleNode("/my:myFields/my:Admin/my:Approval_Status_FLAG").text = "Approved";
                        break;

                        case "In Process":
                        XDocument.DOM.selectSingleNode("/my:myFields/my:Admin/my:Approval_Status_FLAG").text = "In Process";
                        break;

                        case "Rejected":
                         XDocument.DOM.selectSingleNode("/my:myFields/my:Admin/my:Approval_Status_FLAG").text = "Rejected";
                        break;

                        default:
                        XDocument.DOM.selectSingleNode("/my:myFields/my:Admin/my:Approval_Status_FLAG").text = "No Change in Status";
                }

// A field change has occurred and the DOM is writable. Write code here to respond to the changes.
}