Idoc script function to count string

Hi,
Does anyone know if there is any build in function in idoc script to count the number of string.
For example:
A, B, C, D, E
I want to count how many comma's are there using idoc script. If there is no build in function, what would be the best approach to achieve this.
Many thanks.

There is no built in function, but I would simply do this:
<$rsMakeFromString("MyStringRS", "A, B, C, D, E")$>
<$numCommas = MyStringRS.#numRows - 1$>
Good Luck, and please award points as you see fit.

Similar Messages

  • Making Custom Idoc Script function

    Hi all,
    I am making a custom Idoc Script function. I have merged the resource
    table into the core IdocScriptExtensions table. But i am not able to call the custom function in SiteStudio. Find below the steps that i have taken
    step1) I have added a resource (Static Table) in my component which merges to "IdocScriptExtensions" fucntion.
    Step2) I have already created the java class.
    Step3) Edited <td>Myname</td><td>Myclass</td><td>MyloadOrder</td> in the resource with corresponding values.
    Step4) From component settings added the custom classes.
    Step5) made a build of the component.
    Step6) Installed the component in my server.
    now when i go to SS Designer and call this function then no response is generated.
    This component will return me a boolean by quering DB. I have number of sysouts and traces but none of them is printed on the console. Can somebody please provide insited into what probably might be amiss here.
    ANY pointers will be hightly appriciated. waiting for a quick response.
    reagrds,
    sapan

    Hi Sapan,
    For the most part your steps look correct. Personally I would probably do the following:
    1. move your component's classes folder back inside the component
    2. register the folder in the component
    3. add the folder to the class path
    4. in the component's hda file, check to make sure there the merge rule is set for your IdocScriptExtensions entry.
    if all of those are correct, occasionally the content server can be tempermental when new classes are added and so I would try disabling the component, restarting, then enabling and restarting.
    If everything is compiled, it has to be either a classpath issue or an issue merging your IdocScriptExtensions table.
    Also, if you go to Administration>Configuration Info, expand enabled components and find yours, it will tell your the classpath registered for your component(though your code is in the content server classes folder).
    Sounds like you are really close though...did you get the debugger working?
    David

  • Idoc scripting in workflow tokens

    Greetings,
    A question for developers: up to what extent of Idoc Script calls can be made inside Workflow tokens? Only the function wfAddUser or other Idoc Script functions as well?
    I'm trying to develop a dynamic workflow component that involves reading possible user, alias or ad-hoc metadata values from a database table using a custom Idoc Script function, into a token. So basicly, something like this:
    <$wfAddUser(customIdocScriptFunctionToFetchUsers(dDocType),"user")$>
    Is anything like this possible at all? Tests done so far result in the content item entering and exiting the workflow automatically due to probably being unable to load the users, the strange thing is that no erros are being output, not even in the content server output with "workflow" or "idocscript" sections being traced...
    The point of this mechanism is to avoid having to create large ammounts of (hidden) metadata to serve as support to store users/alias to be loaded into workflow steps as tokens. Feel free to suggest any other alternatives tho :p
    Thanks in advance,
    - Tiago Vidigal

    Hey Tiago,
    Typically you try to limit your token script to just wfAddUser. It is possible to use basically any idoc script in a token but any failure at all will result in the behavior you are seeing with the item skipping straight through the step.
    Using your current design here is what I would do:
    -In the entry script for that step make your call via the custom script function
    -Store the result of the lookup into a workflow variable: <$wfSet("usersForStep", getCustomUsers(dDocType))$>
    -do your wfAddUser in the token: <$wfAddUser(wfGet("usersForStep"), "user")$>
    -Sidenote: You can add multiple users at once in one wfAddUser call if you pass a comma delimited string of the usernames
    Reason this works: the Entry script is always evaluated before a token when entering a step, meaning you can put any complex logic there where it is easier to debug and keep your token code clean.
    Hope that helps,
    Andy Weaver - Senior Software Consultant
    Fishbowl Solutions < http://www.fishbowlsolutions.com?WT.mc_id=L_Oracle_Consulting_amw >
    Edited by: Andy Weaver on May 18, 2009 10:55 AM
    (Fixed one of my code snippets)

  • IDOC script to get list of users in alias

    Hi ,
    In Workflow script, I want to check if dDocAuthor exists in some alias. IF exists then do some processing.
    I am not able to compare dDocAuthor with users in alias. Infact I could not find any IDOC script function that returns users in alias.
    Please help.
    thanks

    Check out my blog post on how to bypass workflow via idoc if the author is part of a specific alias (:

  • How to manipulate the date in idoc scripting?

    how can we manipulate date in idoc scripting? How to retrieve the year, month, date from the date? How can we update the year of the particular date in idoc scripting.

    There are a bunch of date / time functions that you can find in chapter 5 of the Idoc Script Reference (the bible for this sort of thing)
    For the sort of things you need to do I would recommend you look at formatDateWithPattern()
    for example to retrieve the year of 'now'
    <$year = formatDateWithPattern(dateCurrent(),"yyyy")$>
    month
    <$month = formatDateWithPattern(dateCurrent(),"MMM")$>
    the patterns for the same rules as Java date formats (unsurprisingly)
    If you want to update the year then I think you need to build the date as a string and the use the parseDate or parseDateWithPattern functions to actually create something that Idoc will recognise as a date object.
    Tim

  • How to pass a JSP var to a Script function called in a netui:checkbox

    How to pass a JSP variable to a Java Script function called in a netui:checkbox onSelect?
    I have a requirement where based on the checkBox selected or deselected in a repeater tag I would have to select or deselect other checkboxes in a netui:form. I am trying to pass the index or unique name of the checkbox to the JavaScript function. When I try this code I am getting a Syntax Error!! and getting a " item undefined" in the javascript. This works when I use just the html form tag but when I use the <netui:form> tag I am facing this issue. Any help would be highly appreciated.
    function selectACheckBoxOnClick(name) {
    alert ("called selectACheckBoxOnClick ");
    alert ("called name "+name);
    <netui-data:repeater dataSource="{pageFlow.unregisteredContractAssetsDTOArr}">
    <netui-data:repeaterItem>
    <% String checkboxName = "selectACheckBox_"+i;
    String serialNum = "serialNum_"+i;
    String hidenboxName = "hiddenACheckBox_"+i;
    String loopNo = new Integer(i).toString();
    System.out.println("Loop String :"+ loopNo);
    System.out.println("CheckBox Name:"+ checkboxName);
    System.out.println("serialNum :"+serialNum); %>
    <tr bgcolor="#ffffff">
    <td align="center">
    <netui:checkBox dataSource="{container.item.selectedAssetFlag}" onSelect="selectACheckBoxOnClick(<%=checkboxName%>);" tagId="<%=checkboxName%>"/>
    </td>
              <td class="small"><netui:label value="{container.item.model}"/></td>
              <td class="small">
    <netui:hidden dataSource="{container.item.splitAssetNo}" tagId="<%=serialNum%>"/>
    <netui:label value="{container.item.serial}"></netui:label></td>
              <td class="small"><netui:label value="{container.item.equpimentId}"/></td>
              <td class="small">
    <netui-data:getData resultId="siteId" value="{container.item.siteNo}" />
    <%String siteId = (String) pageContext.getAttribute("siteId");%>
    <netui:anchor action="getSiteLevelAssets" formSubmit="true">
    <netui:parameter value="{container.item.siteNo}" name="siteNo" />
    <netui:label value="{container.item.siteNo}" />
    </netui:anchor>
    </td>     </tr>
    <%i++;%>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    This code works within a form:
                   <td align=center>
                        <input type=image name="unassign" onclick="javascript:unassignReplacement(<%=replacementSupply.getPMSupplyId()%>)" src="<%=request.getContextPath()%>/images/bt_sm_x.gif" border=0 alt="Unassign">
                        </td>
    Thanks,
    Salome

    hi
    i did not go thru your code completly
    but u can use the following for your problem
    the checkbox in the repeater must have unique TagID
    counter = 0; (initialize)
    <netui-data:repeaterItem>
    <netui:checkBox dataSource="" tagId='<%="count"+String.valueOf(counter)%>' onClick="some function()" />
    <%counter++;%>
    </netui-data:repeaterItem>
    here if u have 3 checkbox
    They will have Tagid's as count1 , count2 and count3
    now in the javascript somefunction()
    use the following line
    for(j=0;j<<%=counter%>;j++)
    document.forms(0)[getNetuiTagName"count"+j)].checked=false;     
    }

  • Calling Java function from java script function

    Hello,
    I have a jsp in which on button click i am calling a java script function. now there is some data that i want to insert in a table on click of the same button. But in order to do that i need to write java code. but if i write java code inside the script function that is called on button click it doesnt work. what i understand is that i need to make a java function inside the jsp & call that from the script function. can someone tell me how to do that ?
    this is the code i have written
    function sendMail(iCount2)
         var eMailAddresses = "";
         var studRegId = "";
         for (var i=0; i <iCount2; i++)
              if(document.getElementById("chk" + i).checked)
                   eMailAddresses = eMailAddresses+document.frmQueryBuilder.hdnEmail.value+",";
                   studRegId = document.frmQueryBuilder.studRegId[i].value;
              <%     if(regTemp != "")
                        MakeConnection mc1 = new MakeConnection();
                        con1 = mc1.DBConnection();
                        String temp = "1";
                        System.out.println("inside the if loop for regTemp");
                        String query1 = "insert into studcompreg (studregid,compid) values(?,?)";
                        stmt1 = con1.prepareStatement(query1);
                        stmt1.setString(1,regTemp);
                        stmt1.setString(2,temp);
                        /*stmt1.setString(3,temp);
                        stmt1.setString(4,"01-jan-2005");*/
                        rsinst = stmt1.executeQuery();
              %>
         win = window.open('BackupMail.jsp?eMailAddresses='+eMailAddresses);

    <%@ page import = "Utils.*" %>
    <%@ page import = "java.sql.*" %>
    <%@ page import = "java.lang.String.*"%>
    <%@ page import = "java.text.*" %>
    <%@ page import = "java.util.*"%>
    <%
         String insertValues[] = new String[10];
         String regTemp = "";
         java.sql.Connection con1 = null;
         java.sql.ResultSet rs1 = null;
         java.sql.PreparedStatement stmt1 = null;
         java.sql.Statement stmtinst = null;
         java.sql.ResultSet rsinst = null;
         java.sql.Connection con = null;
         java.sql.PreparedStatement stmt = null;
         java.sql.ResultSet rs = null;
    %>
    <HTML>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link rel="stylesheet" href="style.css" type="text/css">
    <script language = "javascript">
    /*Client side validations go here*/
    function submitForm()
         document.frmQueryBuilder.submit();
    function selectAll(iCount2)
         for (var i=0; i <iCount2; i++)
              document.getElementById("chk" + i).checked = true;
    function deselectAll(iCount2)
         for (var i=0; i <iCount2; i++)
              document.getElementById("chk" + i).checked = false;
    function sendMail(iCount2)
         var eMailAddresses = "";
         var studRegId = "";
         for (var i=0; i <iCount2; i++)
              if(document.getElementById("chk" + i).checked)
                   eMailAddresses = eMailAddresses+document.frmQueryBuilder.hdnEmail.value+",";
                   studRegId = document.frmQueryBuilder.studRegId[i].value;
                   document.frmQueryBuilder.temp.value ="newOne";
                   document.frmQueryBuilder.submit();
         win = window.open('BackupMail.jsp?eMailAddresses='+eMailAddresses);
    </script>
    </head>
    <BODY>
    <%
    int MaxCount = 15;
    int iCount1 = 0;
    int iCount2 = 0;
    int iCount3 = 0;
    String query = "";
    String eMailAddresses = "";
    StringBuffer sbMail = new StringBuffer();
    //String strValue[] = new String [MaxCount];
    //try
         String strCriteria [] = new String [10];
         String strCondition [] = new String [10];
         String strValue1 [] = new String [10];
         String strCombo [] = new String [10];
         for (iCount3 = 0; iCount3 < 10; iCount3 ++ )
              strCriteria[iCount3] = "";
              strCondition[iCount3] = "";
              strValue1[iCount3] = "";
              strCombo[iCount3] = "";
         if (request.getParameter ("txtAction") != null)
              //String nothing = request.getParameter("chk"+iCount2);
              //System.out.println("Value of checkbox : " +nothing);
              String strQuery[] = new String [MaxCount];     
              StringBuffer sb = new StringBuffer();
              String AccessQuery = "";
              String strTmpQuery = "";
              String strTmpRefType[] = new String [4];
              int QueryLen = 0;
              int ModifyLen = 0;
              int QueryLenNew = 0;
              String strTmpRefType1 = "";
              String strTmpRefType2 = "";
    String strTmpRefType3 = "";
         String strTmpRefType4 = "";
              strQuery[0] = "SELECT STUDREGID, NAME,STUDID,PROGRAM,BRANCH,CPI,EMAIL FROM STUDREGDTLS WHERE";
              sb.append(strQuery[0]);
              for (iCount3 = 1; iCount3 < 11; iCount3 ++)
                   iCount1++;
                   strCriteria[iCount3 - 1] = request.getParameter("criteria" + iCount1);
                   strCondition[iCount3 - 1] = request.getParameter("condition" + iCount1);
                   strValue1[iCount3 - 1] = request.getParameter("value" + iCount1);
                   strCombo[iCount3 - 1] = request.getParameter("combo" + iCount1);
              System.out.println("Loop"+iCount3);
                   if (!request.getParameter("criteria" + iCount1).equals("null"))
                        System.out.println("Started getting parameters");
                        strTmpRefType1 = request.getParameter("criteria" + iCount1);
                        if (request.getParameter("condition" + iCount1).equals("ANYWHERE"))
                                  System.out.println("Entered anywhere if of Anywhere");
                                  strTmpRefType2 = "LIKE";
                        else if (request.getParameter("condition" + iCount1).equals("STARTSWITH"))
                                       strTmpRefType2 = "LIKE";
                             else
                                  System.out.println("Anywhere & Startswith not selected");
                                  strTmpRefType2 = request.getParameter("condition" + iCount1);
                        if (request.getParameter("condition" + iCount1).equals("ANYWHERE"))
                                  strTmpRefType3 = "\'" + "%" request.getParameter("value" iCount1)+ "%" + "\'";
                        else if (request.getParameter("condition" + iCount1).equals("STARTSWITH"))
                                       strTmpRefType3 = "\'" request.getParameter("value" iCount1)+ "%" +"\'";
                             else if (request.getParameter("condition" + iCount1).equals("="))
                                            strTmpRefType3 = "\'" + request.getParameter("value" + iCount1)+ "\'";
                                            System.out.println(strTmpRefType3);
                                  else
                                            strTmpRefType3 = request.getParameter("value" + iCount1);
                        strTmpRefType4 = request.getParameter("combo" + iCount1);
                        System.out.println("Value of strTmpRefType2" +strTmpRefType2);     
                   strQuery[iCount3] = " upper(" strTmpRefType1 ") " strTmpRefType2 " upper(" strTmpRefType3 ") " strTmpRefType4 "";
                        System.out.println("Making Qyery"+iCount3);
                   sb.append(strQuery[iCount3]);
                   if (request.getParameter ("txtAction") != null)
                             MakeConnection mc = new MakeConnection();
                             con = mc.DBConnection();
                             QueryLen = sb.length();                         
                             ModifyLen = strTmpRefType4.length();
                             QueryLenNew = (QueryLen - ModifyLen);
                             sb.delete(QueryLenNew, QueryLen);
                             AccessQuery = sb.toString();
                             System.out.println(AccessQuery);
                             stmt = con.prepareStatement (AccessQuery);
                             rs = stmt.executeQuery();
    %>
    <table width="563" >
    <tr><td><DIV CLASS="windowtitle">Student Search</DIV></td></tr>
    <tr><td><DIV CLASS="udGroupBoxHdrDiv">Enter Search Criteria</DIV></td></tr>
    <tr><td CLASS="bgcol">
    <FORM name=frmQueryBuilder METHOD='POST'>
    <INPUT TYPE=hidden Name='txtAction' value='S'>
    <table >
    <%
         for(iCount1 = 1; iCount1 < 11; iCount1++)
                   System.out.println (strCriteria[iCount1-1]);
                   if(iCount1 == 9)
    %>                         <TR valign=top>
    <%
                   else
    %>                          <TR>
    <%
    %>
    <TD width="47"><LABEL CLASS="assoctext">Criteria </LABEL></td><td width="150">
              <SELECT NAME='<%="criteria" + iCount1%>' size="1">
    <OPTION VALUE='null'>- - - - - - - - - - - - - - - - -</OPTION>
         <OPTION VALUE='AGE' <%=strCriteria[iCount1-1].equals("AGE")?"selected":""%>>AGE</OPTION>
         <OPTION VALUE='BRANCH' <%=strCriteria[iCount1-1].equals("BRANCH")?"selected":""%>>BRANCH</OPTION>
         <OPTION VALUE='CPI' <%=strCriteria[iCount1-1].equals("CPI")?"selected":""%>>CPI</OPTION>
         <OPTION VALUE='DEPARTMENT' <%=strCriteria[iCount1-1].equals("DEPARTMENT")?"selected":""%>>DEPARTMENT</OPTION>
    <OPTION VALUE='DREAMCOMP' <%=strCriteria[iCount1-1].equals("DREAMCOMP")?"selected":""%>>DREAM COMPANY</OPTION>
    <OPTION VALUE='PROGRAM' <%=strCriteria[iCount1-1].equals("PROGRAM")?"selected":""%>>PROGRAM</OPTION>
    <OPTION VALUE='SKILLSET' <%=strCriteria[iCount1-1].equals("SKILLSET")?"selected":""%>>SKILL SET</OPTION>
    <OPTION VALUE='WORKEX' <%=strCriteria[iCount1-1].equals("WORKEX")?"selected":""%>>WORK EX</OPTION>
    </SELECT>
              </TD>
         <TD width="88">
              <SELECT NAME='<%="condition" + iCount1%>'>
                   <OPTION VALUE='<=' <%=strCondition[iCount1-1].equals("<=")?"selected":""%>><=</OPTION>
                   <OPTION VALUE='>=' <%=strCondition[iCount1-1].equals(">=")?"selected":""%>>>=</OPTION>
                   <OPTION VALUE='=' <%=strCondition[iCount1-1].equals("=")?"selected":""%>>EXACT MATCH</OPTION>
                   <OPTION VALUE='ANYWHERE' <%=strCondition[iCount1-1].equals("ANYWHERE")?"selected":""%>>ANYWHERE</OPTION>
                   <OPTION VALUE='STARTSWITH' <%=strCondition[iCount1-1].equals("STARTSWITH")?"selected":""%>>STARTS WITH</OPTION>
              </SELECT>
    </TD><TD width="38"><LABEL CLASS="assoctext">Value </LABEL></TD>
    <TD width="186"><INPUT NAME=<%="value" + iCount1%> value='<%=strValue1[iCount1-1]%>' size="20" >
    </TD>
    <TD width="187"><SELECT NAME='<%="combo" + iCount1%>'>
                   <OPTION VALUE='AND' <%=strCombo[iCount1-1].equals("AND")?"selected":""%>>AND</OPTION>
                   <OPTION VALUE='OR' <%=strCombo[iCount1-1].equals("OR")?"selected":""%>>OR</OPTION>
              </SELECT>
    </TD>
    </TR>
    <%
    %>
    </table>
    </td></tr>
    <tr><td align=center>
    <BR>
    <INPUT CLASS="butstyle" type="button" id="cmdSave" enableAlways = "0" value="Submit" onclick="return submitForm();" >
    </td></tr>
    </table>
    <table width="698">
    <tr><td colspan = 6><DIV CLASS="udGroupBoxHdrDiv">Students Matching the Required Crieria</DIV></td></tr>
    <TR>
         <TD CLASS="tblhdr" width="50"></TD><TD CLASS="tblhdr" width="155">Student Name</TD>     <TD CLASS="tblhdr" width="150">Student
    Id</TD><TD CLASS="tblhdr" width="150">Program</TD><TD CLASS="tblhdr" width="150">Branch</TD><TD CLASS="tblhdr" width="62">CPI</TD>
         </TR>
    <%          int i = 0;
         if (request.getParameter ("txtAction") != null)
                   while( rs.next())
    %>
    <%                         System.out.println("Entered Output Loop"+ rs.getString("Name"));
                             System.out.println("Entered Output Loop.........."+ rs.getString("Email"));     
                             sbMail.append(rs.getString("Email")).append(",");
                             regTemp = rs.getString("STUDREGID");
                             i++;
                             System.out.println("student reg id........."+regTemp);
                             System.out.println("value of i........."+i);
    %>                    
                   <TR CLASS="bgcol">
                             <TD width="25"><INPUT TYPE="checkbox" NAME='<%="chk" + iCount2%>' id='<%="chk" + iCount2%>' VALUE=""></TD>
                             <TD width="155"><INPUT NAME=txtName size=20 value='<%=rs.getString("NAME")%>'></TD>
                             <TD width="150"><INPUT NAME=txtStudId size=20 value='<%=rs.getString("STUDID")%>'></TD>
                             <TD width="150"><INPUT NAME=txtProgram size=20 value='<%=rs.getString("PROGRAM")%>'></TD>
                             <TD width="150"><INPUT NAME=txtBranch size=20 value='<%=rs.getString("BRANCH")%>'></TD>
                             <TD width="62"><INPUT NAME=txtCpi size=4 value='<%=rs.getString("CPI")%>'></TD>
                   </TR>
                             <INPUT type="hidden" NAME=hdnEmail value='<%=rs.getString("Email")%>'>
                             <INPUT type = "hidden" NAME = studRegId value = '<%=rs.getString("studRegId")%>'>
                             <INPUT type ="hidden" NAME =temp value ="">
    <%
                             iCount2++;
         eMailAddresses = sbMail.toString();
                   if (con != null)
                             con.close();
    //catch( Exception e)
              System.out.println ("ERROR " + e);
              if (con != null)
                        con.close();
    %>
    </table>
    <table width="698" align=center>
    <tr><td>
    <BR>
    <INPUT CLASS="butstyle" valign=top type="button" id="cmdSave" enableAlways = "0" value="Select All" onclick="return selectAll(<%=iCount2%>)" >
    </td>
    <td>
    <BR>
    <INPUT CLASS="butstyle" valign=top type="button" id="cmdSave" enableAlways = "0" value="Deselect All" onclick="return deselectAll(<%=iCount2%>)" >
    </td>
    <td>
    <BR>
    <INPUT CLASS="butstyle" valign=top type="button" id="cmdSave" enableAlways = "0" value="Send Mail" onclick="sendMail(<%=iCount2%>)" >
    </td>
    </tr>
    </table>
    </FORM>
    </BODY>
    </HTML>
    <%     System.out.println("value inside hidden var temp"+request.getParameter("temp"));     
         if((request.getParameter("temp") != null) && (request.getParameter("temp").equals("newOne")))
         //if(regTemp != null)
              MakeConnection mc1 = new MakeConnection();
              con1 = mc1.DBConnection();
              String temp = "1";
              System.out.println("inside the if loop for regTemp");
              String query1 = "insert into studcompreg (studregid,compid) values(?,?)";
              stmt1 = con1.prepareStatement(query1);
              stmt1.setString(1,regTemp);
              stmt1.setString(2,temp);
              /*stmt1.setString(3,temp);
              stmt1.setString(4,"01-jan-2005");*/
              rsinst = stmt1.executeQuery();
    %>

  • Change script function, can you?

    Hi everyone
    I got this script,
    function: change font size in selection
    but I want to change the function to selection text frames
    I mean: change the font size in all the selected text frames.
    thanks
    var the_document = app.documents.item(0);
    var the_selection = app.selection[0];
    var the_dialog = app.dialogs.add({name:"Resize selected text"});
    with(the_dialog.dialogColumns.add()){
        with(dialogRows.add()){
            staticTexts.add({staticLabel:"Resize the selected text by"});
            var increase_by = measurementEditboxes.add({editUnits:MeasurementUnits.POINTS, editValue:0});
    the_dialog.show();
    counter = 0;
    do {
        var current_character = the_selection.characters.item(counter);
        current_character.pointSize = current_character.pointSize + increase_by.editValue;
        counter++;
    } while (counter < the_selection.characters.length);
    alert("Done!");
    VK

    Try the following:
    var sel = app.selection;
    if (sel.length == 0 ) {
        alert ( "Nothing selected" ); exit();
    var dlg = app.dialogs.add({ name: "Resize text in selected frames" });
    dlg.dialogColumns.add().staticTexts.add({ staticLabel: "Resize the selected text by:" });
    var increase_by = dlg.dialogColumns.add().measurementEditboxes.add({ editUnits:MeasurementUnits.POINTS, editValue: 0 });
    if (dlg.show()) {
        var dlg_value = increase_by.editValue;
        dlg.destroy();
    else {
        dlg.destroy(); exit();
    for ( var i = 0; i < sel.length; i++ ) {
        var curSel = sel[i];
        if ( curSel.constructor.name == "TextFrame" ) {
            var tsr = curSel.parentStory.textStyleRanges;
            for ( var n = 0; n < tsr.length; n++ ) {
                var curTsr = tsr[n];
                curTsr.pointSize += dlg_value;
            } // for
        } // if
    } // for
    alert( "Done!" );
    –Kai

  • What is the function to count number of spaces in a cell.

    Hi Experts,
    In Webi, i am stuck with one scenario. The scenario is I have a column named Customer Address. In that i want to know how many "spaces" are there for the each row.
    I have created variable and tried using various functions like Count, Substr etc... but those are not appropriate for this scenario. Please Help me.
    Customer Address
    1400 RamNivas Opp.Croma Circle6 Gurgon
    11-88 KPHB Opp.BrandFactory Hyd
    1-4-8 ChitrangColony Vijayanthi Chennai
    I want output like Below,
    Address has to display till second space or till third space or till fourth space........
    based on the client decision i will select the address length.

    Hi Sreeram,
    I hope you are talking about Webi here. This is what I would do if I really want to achieve this. I am not saying this is the best way to do. Give it a try and decide if you can achieve the same results by using some other functions. Here is my answer:
    Lets assume that our address is "1st 2nd 3rd 4th ".
    If your customer decides one space then you will display "1st". if 3 then "1st 2nd 3rd" should be displayed.
    The following example formula should display the values before the 2nd space.
    =Left([CAddr];(Pos([CAddr];" ")+Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" "))-1)
    How it works on "1st 2nd 3rd 4th ":
    1. Get the position of 1st space. You will get 4.
    Pos([CAddr];" ")
    2. Get the remaining string after the 1st space. You will get "2nd 3rd 4th ".
    Right([CAddr];Length([CAddr])-Pos([CAddr];" "))
    3. Get the position of 2nd space in remaining part of the string. You will get 4.
    Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" ")
    4. Get the position of 2nd space in the whole address. You will get 8
    (Pos([CAddr];" ")+Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" "))
    5. Get the string from left until the position of 2nd space. As we will get a leading space we need to subtract 1 from the above formula. You will get "1st 2nd" as result.
    =Left([CAddr];(Pos([CAddr];" ")+Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" "))-1)
    All you need to do is replace "CAddr" with your column name. If your customer decides 3rd position, you can edit this formula to add another step.
    This formula should give you some ideas to get started with. Let me know if something is not clear.
    Sujit.

  • How to run Powershell script (function) through Windows Task Schduler ??

    Hello All,
    i have Powershell script which is created as a function. I have to give parameters to run the script. And it is working fine. Now i want to run this script through windows task scheduler but it is not working. I dont know how to call powershell function
    through task scheduler.
    From command line i run it like this:
    . c:\script\Get-ServiceStatusReport.ps1
    dir function:get-service*
    Get-ServiceStatusReport -ComputerList C:\script\server.txt -includeService "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail mail01.xxx.gov.pk
    In windows Task scheduler I am giving this: it runs but i dont receive any output :
    Program/Script:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Parameter:
    -file ". 'Get-ServiceStatusReport.ps1 -ComputerList C:\script\server.txt -includeService  "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail  mail01.xxx.gov.pk'"
    Please HELP !!!

    Thanks for the reply:
    The script is already saved as Get-ServiceStatusReport.ps1 .
    On powershell it does not run like .\Get-ServiceStatusReport.ps1 (parameter).
    But i have to call it as function:
    Like this:
    Get-ServiceStatusReport -ComputerList C:\script\server.txt -includeService "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail mail01.xxx.gov.pk
    As you said:
    I tried to run it like this:
    Program/Script:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Parameter:
    -file "c:\script\Get-ServiceStatusReport.ps1 -ComputerList C:\script\server.txt -includeService  "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail  mail01.xxx.gov.pk'"
    But its not working , on scheduler its giving error: (0xFFFD0000)
    Please HELP !!!
    WHOLE SCRIPT:
    function Get-ServiceStatusReport
    param(
    [String]$ComputerList,[String[]]$includeService,[String]$To,[String]$From,[string]$SMTPMail
    $script:list = $ComputerList
    $ServiceFileName= "c:\ServiceFileName.htm"
    New-Item -ItemType file $ServiceFilename -Force
    # Function to write the HTML Header to the file
    Function writeHtmlHeader
    param($fileName)
    $date = ( get-date ).ToString('yyyy/MM/dd')
    Add-Content $fileName "<html>"
    Add-Content $fileName "<head>"
    Add-Content $fileName "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
    Add-Content $fileName '<title>Service Status Report </title>'
    add-content $fileName '<STYLE TYPE="text/css">'
    add-content $fileName "<!--"
    add-content $fileName "td {"
    add-content $fileName "font-family: Tahoma;"
    add-content $fileName "font-size: 11px;"
    add-content $fileName "border-top: 1px solid #999999;"
    add-content $fileName "border-right: 1px solid #999999;"
    add-content $fileName "border-bottom: 1px solid #999999;"
    add-content $fileName "border-left: 1px solid #999999;"
    add-content $fileName "padding-top: 0px;"
    add-content $fileName "padding-right: 0px;"
    add-content $fileName "padding-bottom: 0px;"
    add-content $fileName "padding-left: 0px;"
    add-content $fileName "}"
    add-content $fileName "body {"
    add-content $fileName "margin-left: 5px;"
    add-content $fileName "margin-top: 5px;"
    add-content $fileName "margin-right: 0px;"
    add-content $fileName "margin-bottom: 10px;"
    add-content $fileName ""
    add-content $fileName "table {"
    add-content $fileName "border: thin solid #000000;"
    add-content $fileName "}"
    add-content $fileName "-->"
    add-content $fileName "</style>"
    Add-Content $fileName "</head>"
    Add-Content $fileName "<body>"
    add-content $fileName "<table width='100%'>"
    add-content $fileName "<tr bgcolor='#CCCCCC'>"
    add-content $fileName "<td colspan='4' height='25' align='center'>"
    add-content $fileName "<font face='tahoma' color='#003399' size='4'><strong>Service Stauts Report - $date</strong></font>"
    add-content $fileName "</td>"
    add-content $fileName "</tr>"
    add-content $fileName "</table>"
    # Function to write the HTML Header to the file
    Function writeTableHeader
    param($fileName)
    Add-Content $fileName "<tr bgcolor=#CCCCCC>"
    Add-Content $fileName "<td width='10%' align='center'>ServerName</td>"
    Add-Content $fileName "<td width='50%' align='center'>Service Name</td>"
    Add-Content $fileName "<td width='10%' align='center'>status</td>"
    Add-Content $fileName "</tr>"
    Function writeHtmlFooter
    param($fileName)
    Add-Content $fileName "</body>"
    Add-Content $fileName "</html>"
    Function writeDiskInfo
    param($filename,$Servername,$name,$Status)
    if( $status -eq "Stopped")
    Add-Content $fileName "<tr>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$servername</td>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$name</td>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$Status</td>"
    Add-Content $fileName "</tr>"
    else
    Add-Content $fileName "<tr>"
    Add-Content $fileName "<td >$servername</td>"
    Add-Content $fileName "<td >$name</td>"
    Add-Content $fileName "<td >$Status</td>"
    Add-Content $fileName "</tr>"
    writeHtmlHeader $ServiceFileName
    Add-Content $ServiceFileName "<table width='100%'><tbody>"
    Add-Content $ServiceFileName "<tr bgcolor='#CCCCCC'>"
    Add-Content $ServiceFileName "<td width='100%' align='center' colSpan=3><font face='tahoma' color='#003399' size='2'><strong> Service Details</strong></font></td>"
    Add-Content $ServiceFileName "</tr>"
    writeTableHeader $ServiceFileName
    #Change value of the following parameter as needed
    $InlcudeArray=@()
    #List of programs to exclude
    #$InlcudeArray = $inlcudeService
    Foreach($ServerName in (Get-Content $script:list))
    $service = Get-Service -ComputerName $servername
    if ($Service -ne $NULL)
    foreach ($item in $service)
    #$item.DisplayName
    Foreach($include in $includeService)
    write-host $inlcude
    if(($item.serviceName).Contains($include) -eq $TRUE)
    Write-Host $item.MachineName $item.name $item.Status
    writeDiskInfo $ServiceFileName $item.MachineName $item.name $item.Status
    Add-Content $ServiceFileName "</table>"
    writeHtmlFooter $ServiceFileName
    function Validate-IsEmail ([string]$Email)
    return $Email -match "^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"
    Function sendEmail
    param($from,$to,$subject,$smtphost,$htmlFileName)
    [string]$receipients="$to"
    $body = Get-Content $htmlFileName
    $body = New-Object System.Net.Mail.MailMessage $from, $receipients, $subject, $body
    $body.isBodyhtml = $true
    $smtpServer = $MailServer
    $smtp = new-object Net.Mail.SmtpClient($smtphost)
    $validfrom= Validate-IsEmail $from
    if($validfrom -eq $TRUE)
    $validTo= Validate-IsEmail $to
    if($validTo -eq $TRUE)
    $smtp.UseDefaultCredentials = $true;
    $smtp.Send($body)
    write-output "Email Sent!!"
    else
    write-output "Invalid entries, Try again!!"
    $date = ( get-date ).ToString('yyyy/MM/dd')
    sendEmail -from $From -to $to -subject "Service Status - $Date" -smtphost $SMTPMail -htmlfilename $ServiceFilename

  • Javascript/vbscript functionality (java script functions are not running) issue in Internet Explorer 10 and 11

    We have developed web portal using classic ASP and java/vb script.  We used to run it absolutely fine using Internet Explorer 8.  Now we just migrated to Internet Explorer 11.  But after that no java script functionality is working in our
    web portal.
    Our web server is configured on windows 2003 server and IIS version 6.0 and has .net Framework (Microsoft.NET\Framework\v2.0.50727).  
    Could you please suggest us that is there any workaround to this? 

    Hi,
    Have you tested this web portal in compatibility mode, Tools\Compatibility view settings? or click F12 to use the developer tool, change the the document mode and user agent string to 8, check the result.
    And under Tools\Internet Options\Security\Custom level, scroll down to "Scripting", enable "Active Scripting".
    Since you're developer of the web portal, it's recommended to post issue in IE development forum
    https://social.msdn.microsoft.com/Forums/ie/en-US/home?category=iedevelopment
    Regards
    Yolanda Zhu
    TechNet Community Support

  • Deleting several documents in idoc script

    Hello,
    I need some help about one of my customization.
    I would like to create a page on which a user would choose a website
    section and then after choosing it, all the documents of this website
    section would be deleted.
    So, in idoc script, I created a service called "DELETE_DOC_SCRIPTABLE"
    which is the same as "DELETE_DOC" but it is scriptable.
    I also created a service which retrieves all the documents and then I
    loop on the resultset generated and I call the service
    "DELETE_DOC_SCRIPTABLE".
    My first results is then deleted but then, after the first loop, UCM
    doesn't recognize my resultset anymore and so the other results are
    not deleted.
    Here is my code :
    <$loopwhile getValue("RST_DOCS_SECTION_A_SUPPRIMER","#isRowPresent")$>
    <$dID=RST_DOCS_SECTION_A_SUPPRIMER.dID$>
    <$executeService("DELETE_DOC_SCRIPTABLE")$>
    <$exec rsNext("RST_DOCS_SECTION_A_SUPPRIMER")$>
    <$endloop$>
    Here is my error in etc/log file
    "suppression_contenus
    /produits/ucmIntra/dev/custom/GestionSectionsSite/resources/gestionsectionssite_\
    ressources_supprimerContenus.htm
    [ligne 23, car 7]
    An error occured in the file
    '/produits/ucmIntra/dev/custom/GestionSectionsSite/resources/gestionsectionssite\
    _ressources_supprimerContenus.htm'
    q la ligne 98 et au caractre 10. Unable to evaluate the function
    'rsNext'. Unable to find result set 'RST_DOCS_SECTION_A_SUPPRIMER'.
    -> <$exec rsNext("RST_DOCS_SECTION_A_SUPPRIMER")$>
    -> <$endloop$>
    -> </table>
    Thank you in advance if you have any clue about this,
    Regards,
    Julian

    I`ve gotten a little bit closer by hacking at the code..
              <$rsMakeFromString( "rsDeleteDocsBydID", xdID, "dIDstored")$>
              <$numFields = rsNumRows("rsDeleteDocsBydID")$>
              <!-- numFields == <$numFields$> -->
              <!-- To Delete = <$dIDstored$> -->     
              [[%This Works when uncommented %]]
              <!--$dID = dIDstored$-->
              <!--$executeService("ETHER_DELETE_DOC")$-->
              [[%This does not execute the service again? - But returns dIDs correctly??%]]
              <$xnumFields = 0$>
              <$loopwhile xnumFields < numFields $>
                   [[%Recreate RS as Delete_doc service clears all RS?%]]
                   <$rsMakeFromString( "rsDeleteDocsBydID", xdID, "dIDstored")$>
                   <$exec rsSetRow("rsDeleteDocsBydID",xnumFields)$>
                   <$dID = dIDstored$>
                   <!-- Delete this dID = <$dID$> -->
                   <$executeService("ETHER_DELETE_DOC")$>
                   <$xnumFields =(xnumFields +1)$>
              <$endloop$>
    I may look at using the subservice DELETE_BYNAME anyone tried using this instead?
    Thanks

  • MDX - function expects a string or numeric expression for the 1 argument. A tuple set expression was used.

    why this query
    select [Measures].[F Events Count] on 0,
    Filter([D Actor Player].[Actor].children,
    ([Measures].[F Events Count],
    {([D Date].[Hierarchy].[Season].[2012 - 2013]),([D Date].[Hierarchy].[Season].[2013 - 2014])},
    [D Result].[Result].&[Goal])
    >=5) on 1
    from [FBA Cube]
    gives this error:
    Query (3, 3) The >= function expects a string or numeric expression for the 1 argument. A tuple set expression was used.
    while the following query works fine
    select [Measures].[F Events Count] on 0,
    Filter([D Actor Player].[Actor].children,
    ([Measures].[F Events Count],
    [D Date].[Hierarchy].[Season].[2012 - 2013],
    [D Result].[Result].&[Goal])
    >=5) on 1
    from [FBA Cube]
    why having set inside Filter's boolean expression generates that error? how can we
    keep the set inside the Filter's boolean expression but
    solve the problem? please explain the reason and solution

    Hi Butmah ,
    I think you should use an aggregation function with the set and the tuple ... adding an AdventureWorks snippet :
    select [Measures].[Order Count] on 0,
    Filter([Product].[Category].children,
    SUM({[Date].[Fiscal].[Fiscal Year].&[2011],[Date].[Fiscal].[Fiscal Year].&[2009]}
    ,([Measures].[Order Count],[Geography].[Geography].[Country].&[United States])
    >=5) on 1 
    from [Adventure Works]
    Regards, David .

  • How to get the value retruned by java script function into my jsp page

    Hai all,
    I had a particular java script function which returns a date.
    function getDate() {
         var sDate;
    // This code executes when the user clicks on a day in the calendar.
    if ("TD" == event.srcElement.tagName)
    // Test whether day is valid.
    if ("" != event.srcElement.innerText)
    //alert(event.srcElement.innerText);
    sDate = document.all.year.value + "-" + document.all.month.value + "-" + event.srcElement.innerText;
    document.all.ret.value = sDate;
    var mahi=window.open("configurexml.jsp?xyz=document.all.ret.value")
    return sDate;}
    Now i want to display this particular date in my jsp page. can anyone tell me the correct approach or a sample code to diaplay this date in my jsp page.
    <%@ page language="java"
    import="javax.xml.parsers.*,java.io.*,org.w3c.dom.*"%><%@ page import="java.util.*" %>
    !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html> <head> <title>Configuring Xml File</title>
    <SCRIPT LANGUAGE="JavaScript" SRC="xyz.js"> </SCRIPT>
    body bgcolor="#d0d0d0" onClick= "return getDate()" >
    <form name="f1">
    <b>20 october 2006 </b>
    Here where i am printing the date i had to get the value from the js function. how to do that. plz help me....

    Are you talking about server-side java code (servlets/jsp) or client side (applet)? Given we are in the JSP forum I'll assume we're talking server side.
    If so, you are making a common but fundamental mistake. JavaScript executes on the client, not on the server. If you want client data on the server it has to get there somehow. The simplest way to do this in JSP land is via HTTP. So... have your JavaScript code call a JSP (or servlet) and pass the value you want as a URL parameter. Of course this will also change the browser location, so if you don't want this to happen use a frame or iframe to capture your HTTP request.
    For example:
    Javascript....
    function someFunction() {
    return 1;
    var value = someFunction();
    location.href="somejsp.jsp?value=" + value;

  • How to call the java method in java script function in a portal application

    Hi Friends,
    I am developing one application where i need to fetch the data from KM content and displaying it on the screen in regular interval. I wrote one method in JSPdynpage for fetching data from KM content now I need to call that java method in java script function.
    java method(IComponentRequest request)
    //Coode for fetching the KM content
    function()
    <b>//Need to call the java method</b>
    setTimeout(function, 5000);//setting the time interval for this function
    <<htmlb display code>>
    If anybody can help me in calling the java method in java script function that will be very helpful for me.
    Thanks in advance,
    Sandeep Bonam

    Hi,
    Pls see if the following links could help.
    http://www.rgagnon.com/javadetails/java-0170.html
    http://www-128.ibm.com/developerworks/library/wa-resc/?dwzone=web
    Regards

Maybe you are looking for

  • Adobe Media Encoder for CS4 error Could not read from the source

    Hello, I get an error when I try to export from Premiere CS4. It doesn't matter how I export. Seems like an easy fix, but I can't figure it out. Any help is appreciated: - Source File: C:\DOCUME~1\ARTWHI~1\LOCALS~1\Temp\extra and b roll.prproj - Outp

  • Adobe Content Viewer not installed on V28

    Today I updated both my CC and CS6 versions of InDesign, so I now have V28 of DPS tools, however there is no Content Viewer app available for my Mac (Running )SX 10.8.5). When I try to preview on Desktop via the Folio Builder panel, an error stating

  • ***** in the output AT END stmt

    I am getting ***** in the output, if I use the at end stmt. Can anybody tell me the reason and teh solution??

  • Problem in calling a selection-screen

    Hi Friends,     Please see the code below. when r_rbr = 'X', I'm calling sel screen 100. when r_cvr = 'X', I'm calling selection screen 200. Now the problem is that when I call screen 100 or 200 & press BACK button, even then also it goes to start of

  • Windows 7 as ONLY operating system

    I would like to install Windows 7 in an Intel Mac mini as the PRIMARY/ONLY operating system (without Mac OS or boot-camp). I love my Macintosh and Macintosh hardware in general, but I need to provide a small-sized Windows 7 system for a very non-tech