DateTimeField

Dear all,
I am working with LiveCycle Designer ES 8.2 (German version).
I have a form with a datetimefield (the value can be changed by the user). The date is shown like  "date{D.MM.YY}"and it must be like this. The display cannot be changed to "date{WW}" and thus "this.formattedValue" will not work out.
But I need the week number ("date{WW}") of the entered date of the datetimefield for further calculation.
Does anybody have an idea how to get the week number out of a datetimefield with Javascript?
Many hanks.
Regards,
ra_be

Hi ra_be,
You can use the same XFA picture clauses in the util.printd method. Both util.printd() and util.scand() are part of the Acrobat JavaScript and are described in the "Acrobat JavaScript Scripting Reference".  A bit confusing because that use different picture clauses, e.g. "MM" in XFA is a zero padded month but in printd is the zero padded minutes.
Anyway try something like;
util.printd(
"date(de_DE){WW}", util.scand("d.mm.yy", DateTimeField1.formattedValue), true)
Where "date(de_DE){WW}" is the output format using the german locale and "d.mm.yy" is the Acrobat version of your XFA formatted date field.
Bruce

Similar Messages

  • DateTimeField and  an additional TextField

    I have a combination of a textfield and a datetimefield. The user can select any date in the textfield and he can choose a date from the calendar. When the user select the date via the calendar the value of the textfield will be set to the selected date. Now my problem: how can I make the picker (the dropdown arrow) of the calendar visible when clicking the textfield? My first try with execute the click-event of the dattimefield wasn't successful. Anybody experiences or suggestions?

    The only time the dropdown arrow will become active is when focus is put onto the field. Obviously you cannot have focus on the DateTime Field while you are filling the other field so I do not see how you can do this. You can however put focus on the DateTime field on exit of the text field by either modify the tabbing order or adding script to the exit event of the TextField. You would add this code:
    xfa.host.setFocus("FieldName");
    Hope that helps

  • Display pattern for DateTimeField ignored when setting value from script

    Hello,
    I have a DateTimeField with Data pattern date{DD.MM.YYYY} and Display pattern date{MMMM}, so it displays its default value "21.05.2011" as "May". Now I'm setting its value from the other field's initialize event:
    if (this.rawValue) {
        data.Subform_Footer2.DateTimeField1.rawValue = this.rawValue.match(/\d+\.\d+\.\d+/)[0];
    Assuming this.rawValue contains text "21.04.2011", the DateTimeField displays "21.04.2011" in preview instead of "April" as specified in Display pattern.

    Hi,
    To me it looks like you are passing a string to the date field, rather than a date.
    Instead of trying to abstract the month manually in the script, why not pass the whole date through "21.04.2011" and leave the display pattern display the month.
    Niall

  • DateTimeField - Mobile

    If i hava a FormField / DateTimeField located located down on the page so that you have to scroll down to it.
    When you click the calendar icon, it resets the scrollbar to the top. When i scroll down the calendar is visible.
    (Happens both when the Workspace has a scrollbar or the body has a scrollbar.
    Now this only happens on mobile devices. Android / iphone / ipad etc.
    When you click on the calendar icon on a PC, any browser, the scroll stays in the right Place and the calendar displays
    below the calendar button.
    So any one experienced the same thing ? And has anyone any idea how to fix this ?
    Kinda hard to figure out whats going on on the device..
    Regards

    I just verified this problem on a oob SharePoint sitecollection.
    In case we had thrashed some JavaScript/css or whatever.
    I moved the calendar down in the article layout page With a lot of <br>'s.
    When i click on the claendar on a mobile phone, any phone type. The scroll is reset to the top of the page.
    On desktop, it works ok.
    So i guess, another SharePoint bug.

  • "Failed to open the connection" problem related to multiple tables in the report?

    Post Author: Gadow
    CA Forum: Data Connectivity and SQL
    System specifics:
    Web environment using ASP.Net 2.0 (from Visual Studio 2005 Professional)
    Crystal Reports 2008, v. 12.0.0.549, Full
    We have set up the following method for displaying reports via our website:
    User is sent to a report-specific page. The user is given some filtering options specific to the report that will be viewed. When the user has specified the data filters, the user clicks a button.
    The page wraps up the report parameters -- selection query, formula values, report location, the name to be displayed, etc. -- into a class which gets put into the Session object.
    The page redirects to DisplayReport.aspx. ALL reports redirect to this page.
    DisplayReport.aspx retrieves the report parameters from Session. A ReportDocument object is created and loaded, then set with the data from the parameters class.
    A ConnectionInfo object is created and set with the relevant log on credentials. All of the reports draw from the same database, so the connection information is hard-coded as the same for all reports. The page then iterates through all of the tables in the Database.Tables collection of the ReportDocument and calls ApplyLogOnInfo to each table using the ConnectionInfo object.
    The page is rendered and the user gets the filtered report.
    We currently have seven reports. Five reports work fine and display the correctly filtered data with no error messages. Two reports generate a Failed to open the connection error and do not display. I have verified that the queries being sent to DisplayReport.aspx are valid, and as I said the connection information itself is hard-coded in the one page that displays the reports and this is identical to all reports.
    The five reports that do work all have a single data table, either an actual database table or a single view. The two reports that do not work all have multiple tables. As far as I can tell, this is the only difference between the sets; all seven reports are based on the same DSN and I have verified the database on all of the reports. All of the reports were written using Crystal Reports 8, and all of the reports display fine in a Windows app I wrote some years ago using Crystal Reports 8. Again, the only difference between those reports that do work and those that do not is the number of tables used in the report: one table or view in the reports that display, more than one table (tables only, none use views) in the reports that do not display.
    As for the code I am using, below are the relevant methods. The function MakeConnectionInfo simply parses out the components of a standard SQL connection string into a ConnectionInfo object. DisplayedReport is the ID of the CrystalReportViewer on the page.Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim o As Object = Session("ReportParams")
            Dim ReportURL As String = ""
            'Verify that there is a ReportParameters object
            If o Is Nothing OrElse o.GetType IsNot GetType(ReportParameters) Then 'Redirect to the error page
                Response.Redirect("/errors/MissingReport.aspx")
            End If
            ReportParams = CType(o, ReportParameters)
            'Verify that the report exists
            ReportURL = "/Reports/ReportFiles/" + ReportParams.ReportName
            ReportPath = Server.MapPath(ReportURL)
            If Not File.Exists(ReportPath) Then
                Response.Redirect("/errors/MissingReport.aspx?Report=" + ReportParams.ReportTitle)
            End If
            InitializeReport()       
        End Sub
        Protected Sub InitializeReport()
            Dim RD As New ReportDocument
            Dim CI As ConnectionInfo = MakeConnectionInfo(DB_Bonus)
            Dim RPF As CrystalDecisions.Shared.ParameterField = Nothing
            RD.Load(ReportPath)
            If ReportParams.SelectString <> "" Then
                Dim Adapt As New SqlDataAdapter(ReportParams.SelectString, DB_Bonus)
                Dim DS As New Data.DataSet
                Adapt.Fill(DS)
                RD.SetDataSource(DS.Tables(0))
            End If
            For Each kvp As KeyValuePair(Of String, String) In ReportParams.Formulas
                Dim FFD As FormulaFieldDefinition = Nothing
                Try
                    FFD = RD.DataDefinition.FormulaFields(kvp.Key)
                Catch ex As Exception
                    'Do nothing
                End Try
                If FFD IsNot Nothing Then
                    Select Case FFD.ValueType
                        Case FieldValueType.DateField, FieldValueType.DateTimeField
                            If IsDate(kvp.Value) Then
                                FFD.Text = String.Format("Date()", Convert.ToDateTime(kvp.Value).ToString("yyyy, MM, dd"))
                            Else
                                FFD.Text = "Date(1960, 01, 01)"
                            End If
                        Case FieldValueType.StringField
                            FFD.Text = String.Format("""""", kvp.Value)
                        Case Else
                            'For now, treat these as if they were strings. If things blow up here,
                            'we will need to add the appropriate formatting for the field type.
                            FFD.Text = String.Format("""""", kvp.Value)
                    End Select
                End If
            Next
            For Each T As CrystalDecisions.CrystalReports.Engine.Table In RD.Database.Tables
                Dim TLI As TableLogOnInfo = T.LogOnInfo
                TLI.ConnectionInfo = CI
                T.ApplyLogOnInfo(TLI)
            Next
            DisplayedReport.ReportSource = RD
        End Sub
    Does this approach not work with reports containing multiple tables, or is there something I'm missing? Any meaningful suggestions would be much appreciated.

    Dear Dixit,
    Please refer to the Crystal report landing page to get the details
    information about the support for crystal report issues.
    Please use the following thread to post your questions related to
    crystal report.
    SAP Business One and Crystal Reports
    Regards,
    Rakesh Pati
    SAP Business One Forum Team.

  • Issues with changing connection at run-time

    Post Author: dmazourick
    CA Forum: Data Connectivity and SQL
    Weu2019ve tried a lot of different ways to resolve this issue, but are getting every time the different result.
    Probably someone deal with that issue before and know how to correctly resolve it.
    Weu2019re using Crystal Reports Runtime Components X+ (X, XI, XI R2) u2013 all of them has this issue.
    We need client application to connect to multiple data sources u2013 user chooses report, chooses data source and we show the report for specified data source.
    The data sources are tables or stored procedures stored in different databases on different servers.
    For sure, every data source for a single report has the same structure, but that doesnu2019t matter.
    The issue is: when the name of the database on one server is the same as the name of database on second server, the connection caching occurs.
    How we can check that:
    1.       Weu2019re running report for Server1:<DBN> - report shows data from Server1.
    2.       Weu2019re opening second report for Server2:<DBN> - report shows data from Server1.
    3.       Weu2019re closing application and run 1-2 in opposite order, now both reports show data from Server2.
    Weu2019ve tried different approaches u2013 below is a code sample that opens the report for specific connection.
    Juts to be sure that no one will ask u2013 u201CAre you sure youu2019re passing the correct connection info etc.u201D. Yes! We are sure because weu2019re trying to fix this issue for a long time and tried a lot of different approaches and still cannot find the right solution.
    The code looks like below. This is VB6 code, but also the same situation was tried on VC++ 6.0
    Weu2019re not looking into CR.NET solution for now.
    =================================================
    Sub DisplayReport(Server as String, DB as String, UID as String, PWD as String, viewer as Object)
        Dim app As New CRAXDRT.Application
        Dim report As CRAXDRT.report
        Dim database As CRAXDRT.database
        Dim table As CRAXDRT.DatabaseTable
        Dim par As CRAXDRT.ParameterFieldDefinition
        Set report = app.OpenReport("D:\TestReport_X.rpt")
        report.database.LogOnServer "pdssql.dll", Server, DB, UID, PWD
        Set table = report.database.Tables(1)
        table.SetLogOnInfo Server, DB, UID, PWD
        table.Location = table.Name
        report.database.Verify
        viewer.ReportSource = report
        viewer.ViewReport
    end sub
    =================================================
    The result of above code is the following:
    1.       If we will pass the same viewer and will use different Server u2013 the report will be displayed correctly
    2.       If we will pass different viewers and will use different Server u2013 the reports will contain same data
    The result of above code also depends from the version of Crystal Reports the report was designed in:
    1.       For Report designed in 8.5 u2013 passing of the same viewer with same connection info second time will refresh report
    2.       For Report designed in X, XI, XI R2 u2013 no refresh
    Also, a slight modification of the above code helps for reports designed in XI to work properly, but not for reports designed in X and 8.5:
    1.       Before calling LogonServer, make the following: DB = DB & u201C;u201D & Int(rnd()*32767)
    That makes report designed in XI to display properly in different viewers, but doesnu2019t have any impact to X and no any impact to 8.5
    Weu2019re really looking for any help in this question

    Post Author: fburch
    CA Forum: Data Connectivity and SQL
    I am having similar problems and some successes.
    I have 70+ reports and now suddenly I want to point them at two different servers, but at databases with the same name like you talked about.
    I first just tried the following:
    #1. Load report:
    Dim myReport As New ReportDocument
    myReport.Load(filename)
    #2. Pass in parameter values
    ''Get the collection of parameters from the report
    Dim crParameterFieldDefinitions As ParameterFieldDefinitions = r.DataDefinition.ParameterFields
    ''Access the specified parameter from the collection
    Dim crParameter1 As ParameterFieldDefinition = crParameterFieldDefinitions.Item(ParamName)
    ''Get the current values from the parameter field. At this point
    ''there are zero values set.
    'crParameter1Values = crParameter1.CurrentValues
    ''Set the current values for the parameter field
    Dim crDiscrete1Value As New ParameterDiscreteValue
    If crParameter1.ValueType = FieldValueType.DateField Or crParameter1.ValueType = FieldValueType.DateTimeField Then
    If ParamValue Is System.DBNull.Value Then
    crDiscrete1Value.Value = CDate("1/1/1900")
    ElseIf ParamValue Is Nothing Then
    crDiscrete1Value.Value = CDate("1/1/1900")
    Else
    crDiscrete1Value.Value = ParamValue
    End If
    ElseIf crParameter1.ValueType = FieldValueType.StringField Then
    If ParamValue Is Nothing Then
    crDiscrete1Value.Value = ""
    Else
    crDiscrete1Value.Value = ParamValue
    End If
    ElseIf crParameter1.ValueType = FieldValueType.BooleanField Then
    If ParamValue Is Nothing Then
    crDiscrete1Value.Value = False
    ElseIf ParamValue.ToString.ToUpper = "TRUE" Then
    crDiscrete1Value.Value = True
    Else
    crDiscrete1Value.Value = False
    End If
    ElseIf crParameter1.ValueType = FieldValueType.NumberField Then
    If ParamValue Is Nothing Then
    crDiscrete1Value.Value = 0
    Else
    crDiscrete1Value.Value = ParamValue
    End If
    Else
    If ParamValue Is System.DBNull.Value Then
    crDiscrete1Value.Value = Nothing
    ElseIf ParamValue Is Nothing Then
    crDiscrete1Value.Value = Nothing
    Else
    crDiscrete1Value.Value = ParamValue
    End If
    End If
    ''Add the first current value for the parameter field
    Dim crParameter1Values As New ParameterValues
    crParameter1Values.Add(crDiscrete1Value)
    ''All current parameter values must be applied for the parameter field.
    crParameter1.ApplyCurrentValues(crParameter1Values)
    #3 Set "Table Log in info" (most of my reports using stored procedures, but I guess I still needed this step).
    Dim CrTables As Tables = r.Database.Tables
    Dim CrTable As Table
    Dim crtableLogoninfos As New TableLogOnInfos()
    Dim crtableLogoninfo As New TableLogOnInfo()
    With crConnectionInfo
    .ServerName = connectionParser.GetServerName(connectionString)
    .DatabaseName = connectionParser.GetDatabaseName(connectionString)
    If connectionParser.DoesUseIntegratedSecurity(connectionString) = True Then
    .IntegratedSecurity = True
    Else
    .UserID = connectionParser.GetServerUserName(connectionString)
    .Password = connectionParser.GetServerPassword(connectionString)
    .IntegratedSecurity = False
    End If
    End With
    For Each CrTable In CrTables
    crtableLogoninfo = CrTable.LogOnInfo
    crtableLogoninfo.ConnectionInfo = crConnectionInfo
    CrTable.ApplyLogOnInfo(crtableLogoninfo)
    If InStr(CrTable.Location, ".dbo.") = 0 Then
    CrTable.Location = crConnectionInfo.DatabaseName + ".dbo." + CrTable.Location
    End If
    Next
    If r.Subreports.Count > 0 Then
    Dim crSections As Sections
    Dim crSection As Section
    Dim crReportObjects As ReportObjects
    Dim crReportObject As ReportObject
    Dim crSubreportObject As SubreportObject
    Dim crDatabase As Database
    Dim subRepDoc As New ReportDocument()
    'SUBREPORTS
    'Set the sections collection with report sections
    crSections = r.ReportDefinition.Sections
    'Loop through each section and find all the report objects
    'Loop through all the report objects to find all subreport objects, then set the
    'logoninfo to the subreport
    For Each crSection In crSections
    crReportObjects = crSection.ReportObjects
    For Each crReportObject In crReportObjects
    If crReportObject.Kind = ReportObjectKind.SubreportObject Then
    'If you find a subreport, typecast the reportobject to a subreport object
    crSubreportObject = CType(crReportObject, SubreportObject)
    'Open the subreport
    subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
    crDatabase = subRepDoc.Database
    CrTables = crDatabase.Tables
    'Loop through each table and set the connection info
    'Pass the connection info to the logoninfo object then apply the
    'logoninfo to the subreport
    For Each CrTable In CrTables
    crtableLogoninfo = CrTable.LogOnInfo
    crtableLogoninfo.ConnectionInfo = crConnectionInfo
    CrTable.ApplyLogOnInfo(crtableLogoninfo)
    If InStr(CrTable.Location, ".dbo.") = 0 Then
    CrTable.Location = crConnectionInfo.DatabaseName + ".dbo." + CrTable.Location
    End If
    Next
    End If
    Next
    Next
    #4 go get the data
    crv.ReportSource = myReport
    crv.Refresh()
    #5 Call export to disk function.
    This was not changing server - did not realize it was a caching problem as you suggested. That makes sense. So anyway, then of course I threw a verify database statement on there, before I get the data. Now looks like this:
    #1 Load Report
    #2. Pass in parameter values (dummy values that will generate schema of table without having to actually run long running procedures, i.e. select (cast 1 as int) as somefield1, cast(2.0 as numeric(10,0)) as somefield2
    #3 Set "Table Log in info"
    #3b Verify the database which seems to be a necessity:
    myReport.VerifyDatabase()
    #3c Re-populate the report with real parameter values, same as #2 but this time with the ones that will generate the real data
    #4 go get the data
    #5 Call export to disk function.
    This does work, some of the time. When the datasource underlying report are tables, it works. I made a dummy crystal report with lots of different types of params (stored procedure underlying database) - this also worked!
    Unfortunately, when I run this against the majority of my reports, I get this stupid "invalid mapping type value", for which I have not been able to resolve yet.
    I also tried putting a myreport.SetDatabaseLogon("","") -- what would this do, clear it out? (saw this referenced somewhere).
    Then I tried putting the real connection info in there as well ...
    myReport.SetDatabaseLogon(uid, pwd, serverName, DBname)
    I put this setdatabase thing before I called verifydatabase, which is where the process is bombing out and giving me invalid mapping type for the reports that do not run.
    At this point I am still working on solution. I have tried creating dummy report that used same parameter types as a report that was failing and voila - the dummy report worked. Anyway, let me know if you get your problem fixed and I will do the same. Looks like you are using a different method that I didn't notice "LogOnServer"

  • Logon Error when SetTableLocation with RAS SDK

    Hi
    I have a lot of Reports based on TTX files. As these don't work anymore in an 64 bit environment with CRVS2010 I tried to make an update program based on an replace_click sample in this newsgroup.
    My program is 32 Bit (x86) on an Windows 7 with VS2010. Cr2010 SP1 (13.0.1.220) 32 and 64 Bit is installed.
    After creating an XML-file I want to set the new table location with SetTableLocation method:
    I always get this Error: Logon Failed. Error in File xxx.rpt: Unable to connect: incorrect log on parameters.
    I tested this with two super easy reports created with Crystal Reports 10: 
    First: 1 Table (based on ttx) with only one String filed. no subreports.
    Second: Same report based on an XML File
    With Crystal Reports 10 I can update the Report with the created XML-File.
    public convert(NewFilename as String)
            Dim lCR As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            lCR = New CrystalDecisions.CrystalReports.Engine.ReportDocument
            Try
                lCR.Load(NewFileName)
                Dim rcd As ISCDReportClientDocument
                rcd = lCR.ReportClientDocument
                For i As Integer = 0 To rcd.SubreportController.GetSubreportNames.Count - 1
                    ConvertReportTables(NewFileName, rcd, rcd.SubreportController.GetSubreportNames.Item(i), True)
                Next
                ConvertReportTables(NewFileName, rcd, "", False)
    end sub
    Jürgen
    Edited by: Jürgen Bauer on Jun 7, 2011 1:55 PM

    Private Sub ConvertReportTables(ByRef destination As String, ByRef lcr As ISCDReportClientDocument, srp As String, issubrpt As Boolean)
           Dim boTables As CrystalDecisions.ReportAppServer.DataDefModel.ISCRTables
            If issubrpt Then
                boTables = lcr.SubreportController.GetSubreport(srp).DatabaseController.Database.Tables
            Else
                boTables = lcr.DatabaseController.Database.Tables
            End If
            For Each Table As CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable In boTables
                'Dateiname für Tabellendefinition erzeugen
                Dim XMLFile As String
                XMLFile = destination
                XMLFile &= "_R_" & srp
                XMLFile &= "_T_" & Table.Name.Trim & ".xml"
                'Tabellendefinition lesen und in Datei schreiben
                Dim dt As New DataTable
                For Each field As CrystalDecisions.ReportAppServer.DataDefModel.Field In Table.DataFields
                    Dim fieldtype As String = ""
                    Select Case field.Type
                        Case FieldValueType.BitmapField, FieldValueType.BlobField, FieldValueType.IconField, FieldValueType.OleField, FieldValueType.PictureField
                            fieldtype = "System.Byte[]"
                        Case FieldValueType.BooleanField
                            fieldtype = "System.Boolean"
                        Case FieldValueType.CurrencyField, FieldValueType.NumberField
                            fieldtype = "System.Decimal"
                        Case FieldValueType.TimeField, FieldValueType.DateField, FieldValueType.DateTimeField
                            fieldtype = "System.DateTime"
                        Case FieldValueType.Int16sField, FieldValueType.Int16uField, FieldValueType.Int32sField, FieldValueType.Int32uField, FieldValueType.Int8sField, FieldValueType.Int8uField
                            fieldtype = "System.Int32"
                        Case FieldValueType.StringField
                            fieldtype = "System.String"
                        Case Else
                            fieldtype = "System.String"
                    End Select
                     dt.Columns.Add(New DataColumn(field.Name, Type.GetType(fieldtype)))
                Next
                dt.TableName = Table.QualifiedName
                Dim ds As New System.Data.DataSet
                ds.Tables.Add(dt)
                ds.WriteXml(XMLFile, XmlWriteMode.WriteSchema)
                'boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
                Dim boMainPropertyBag As New PropertyBag()
                'boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
                'In the main property bag (boMainPropertyBag)
                Dim boInnerPropertyBag As New PropertyBag()
                'Set the attributes for the boInnerPropertyBag
                boInnerPropertyBag.Add("File Path", XMLFile)
                boInnerPropertyBag.Add("Internal Connection ID", Guid.NewGuid.ToString)
                'Set the attributes for the boMainPropertyBag
                boMainPropertyBag.Add("Database DLL", "crdb_adoplus.dll")
                boMainPropertyBag.Add("QE_DatabaseName", "")
                boMainPropertyBag.Add("QE_DatabaseType", "ADO.NET (XML)")
                'Add the QE_LogonProperties we set in the boInnerPropertyBag Object
                boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag)
                boMainPropertyBag.Add("QE_ServerDescription", "NewDataSet")
                boMainPropertyBag.Add("QE_SQLDB", "False")
                boMainPropertyBag.Add("SSO Enabled", "False")
                'Create a new ConnectionInfo object
                Dim boConnectionInfo As New CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo()
                'Pass the database properties to a connection info object
                boConnectionInfo.Attributes = boMainPropertyBag
                'Set the connection kind
                boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE
                Dim boTable As CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable
                boTable = Table.Clone(True)
                boTable.ConnectionInfo = boConnectionInfo
                Try
                    If issubrpt Then
                        lcr.SubreportController.GetSubreport(srp).DatabaseController.SetTableLocation(Table, boTable)
                        lcr.VerifyDatabase()
                    Else
                        lcr.DatabaseController.SetTableLocationEx(Table, boTable)
                        lcr.VerifyDatabase()
                    End If
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            Next
      End Sub

  • How to create a control and add it to a page layput

    I am reading the following link :-
    http://www.itidea.nl/index.php/what-about-you-must-fill-out-all-required-properties-before-completing-this-action-when-publishing-a-page/
    which says that i need to create a control and add it to a page layout. but can anyone help me in understanding how i can create a user control and add them to page layout ?
    Thanks

    > First problem  i could not find a User Control (Farm Solution only) under the Office/SharePoint section
    if you mean New item in Visual Studio, then check it under general Web category. User controls are basic ASP.Net functionalities, not Sharepoint-specific. If it is not there, you may use the following trick:
    1. Create new project in other VS instance using "ASP.Net Empty Web Application" template
    2. Add new user control there (in this project type it should exist for sure under Web category. Called "Web User Control")
    3. Copy all user control's files to the folder of your Sharepoint project (ascx, ascx.cs, ascx.designer.cs)
    4. In VS instance with Sharepoint project add existing items: all copied user control files. They should be grouped under ascx file automatically after that
    > The type or namespace name 'TaxonomyFieldControl' could not be found (are you missing a using directive or an assembly reference?)"
    you need to add reference to Microsoft.SharePoint.Taxonomy.dll assembly, which is located in the GAC (assume that you have installed Sharepoint on your dev env)
    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com
    thanks a lot for your help. so can i do the following steps:-
    I follow these steps to deploy a user control.
    using Visual Studio 2012 , i added a new Farm solution.
    then inside the farm solution i added a new User Control(Farm Solution Only).
      3.   inside the user control i entered the following code:-
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Taxonomy;
    using Microsoft.SharePoint.WebControls;
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    namespace WikiPopUp.ControlTemplates.WikiPopUp
    [ToolboxData("<{0}:CustomValidationRequiredFieldsOnPage runat=server></{0}:CustomValidationRequiredFieldsOnPage>")]
    public class CustomValidationRequiredFieldsOnPage : WebControl
    protected override void CreateChildControls()
    base.CreateChildControls();
    if (SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
    bool arethere = AreThereAnyMissingRequiredFieldsOnPage();
    if (arethere)
    //SPPageStateControl:
    //Provides an ASP.NET control that handles the Ribbon buttons controlling the state of a Microsoft SharePoint Server wiki or publishing page,
    //such as the CheckInCheckOutButton or the PublishingButton.
    SPPageStateControl baseParentStateControl = Page.Items[typeof(SPPageStateControl)] as SPPageStateControl;
    //Publish button: SPListItem MissingRequiredFields checks this.FieldHasValue(link.Name, field);
    //the field is empty (which is right) when the page is first created (MMD field is never filled in)
    //when the field was once filled, saved and emptied the field in sp code still has the previous value and the check MissingRequiredFields succeeds
    //after succeeding this check the page is validated (this.Page.Validate()) and this one fails which results SP validating the page as the Save button does
    if (baseParentStateControl.HasError)
    //this overwrites the previous PageErrorState
    //and validates the page
    //no popup anymore and status updates in yellow area
    baseParentStateControl.EnsureItemSavedIfEditMode(false);
    else
    //there are missing fields at this listitem, but they're not on the page
    //do nothing here, because the SerializedErrorState contains the navigate url to the Edit Properties page
    //and a message pops up
    /// <summary>
    /// Check if required fields are missing which are present at the page
    /// </summary>
    /// <returns></returns>
    private static bool AreThereAnyMissingRequiredFieldsOnPage()
    foreach (Control control in SPContext.Current.FormContext.FieldControlCollection)
    //get the control type
    string type = control.GetType().Name;
    FieldTypes controlType = (FieldTypes)Enum.Parse(typeof(FieldTypes), type);
    switch (controlType)
    case FieldTypes.TaxonomyFieldControl:
    TaxonomyFieldControl tfc = control as TaxonomyFieldControl;
    if (!tfc.IsValid)
    return true;
    break;
    default:
    break;
    return false;
    enum FieldTypes
    DateTimeField, FieldValue, TextField, RichImageField, NoteField, RichHtmlField, PublishingScheduleFieldControl, TaxonomyFieldControl, BooleanField, ComputedField
      4. i add a reference for the Sharepoint.taxnomy
      5. then i deploy the solution to my site collection. and now i can see the new solution inside the farm solution under central administration.
    but not sure if these are all the required steps to register the user control or still i need to do extra steps ?

  • Custom control in custom page layout not getting shown

    Hi,
    I have created a site column for Date field:
    <Field ID="{GUID}" Name="MyCustomPageLayoutDate" StaticName="MyCustomPageLayoutDate" Group="TestGroup" Type="DateTime" Format="DateOnly" DisplayName="Date" Required="FALSE" ><Field ID ="{guid}" Name ="MyCustomLayoutDateDisplay" DisplayName="Date Display"
             Group="TestGroup"
             Type="Calculated"
             ResultType="Text"
             ReadOnly="TRUE"
             Required="FALSE">
        <Formula>=TEXT([Date],"MMMM dd, yyyy")</Formula>
      </Field>
    This is added in the page layout content type:
    <FieldRef ID="{guid}" Name="MyCustomPageLayoutDate" />  <FieldRef ID="{guid}" Name ="MyCustomLayoutDateDisplay" />
    In the custom page layout, it is added as below:
    <Publishing:EditModePanel ID="EditModePanel5" runat="server" CssClass="edit-mode-panel">
    <tr>
    <td>
    Date
    </td>
    </tr>
    </Publishing:EditModePanel>
    <PublishingWebControls:EditModePanel ID="DateEditModePanel" runat="server" PageDisplayMode="Edit" SupressTag="True">
    <tr>
    <td >
    <PageFieldDateTimeField:DateTimeField ID="DateTimeField1" FieldName="GUID" runat="server">
    </PageFieldDateTimeField:DateTimeField>
    </td>
    </tr>
    </PublishingWebControls:EditModePanel>
    <PublishingWebControls:EditModePanel ID="DatePublishModePanel" PageDisplayMode="Display" runat="server">
    <tr>
    <td>
    <SharePoint:CalculatedField ID="CalculatedDateField" FieldName="guid" runat="server" />
    </td>
    </tr>
    </PublishingWebControls:EditModePanel>
    In the edit mode, the date is getting shown, and I am able to select a date. When the page is published, the entered date is not getting displayed.
    How to fix this?
    Thanks

    Hi,
    I tried to reproduce this issue like this:
    1. Create a DateTime site column “MyDateTimeCol01”;
    2. Create a Calculated site column “MyCalculated03” with formula “=TEXT(MyDateTimeCol01,"MMMM dd, yyyy")”;
    3. Create a Page Layout content type contains the two site columns above;
    4. Create a Page Layout with the Page Layout content type, the source code of this page layout as below:
    <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
    <PublishingWebControls:EditModePanel runat=server id="EditModePanel1" PageDisplayMode="Edit">
    <SharePointWebControls:DateTimeField FieldName="9492c1ff-851f-4d1c-bcbf-5637b69ebd63" runat="server"> </SharePointWebControls:DateTimeField>
    </PublishingWebControls:EditModePanel>
    <br/>
    <PublishingWebControls:EditModePanel runat=server id="EditModePanel2" PageDisplayMode="Display">
    date time text:
    <br/>
    <SharePointWebControls:CalculatedField FieldName="9c00c4dc-6a53-4abd-9fa4-6b4dd266c898" runat="server"></SharePointWebControls:CalculatedField>
    </PublishingWebControls:EditModePanel>
    </asp:Content>
    5. After that, create a publishing page with this custom page layout:
    In Edit mode:
    In Display mode:
    I suggest you follow the steps above to make another test to see if the issue persists.
    Thanks 
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Daily average report

    I need to design a Crystal report that shows the average number of scheduled appointments per day in the next 4 weeks.
    (This will be a rolling weekly report.)
    The fields I am working with are "ApptDateTime" and "PatientNumber"  (Our database has no "ApptDate" field, so I usually work around this by using a parameter)
    The results should look like this:
    WEEK of
    Mon
    Tues
    Wed
    Thurs
    Friday
    AVERAGE# Appts
    Aug 4
    2
    2
    2
    2
    2
    2
    Aug 11
    4
    2
    4
    3
    4
    3
    Aug 18
    5
    2
    5
    2
    1
    3
    Any help would be greatly appreciated!

    Hi,
    A crosstab, as Brian suggests, is the ideal way to go about building such reports. Do note however, that it will skip any rows/columns that doesn't have any data in the database.
    You don't want a crosstab that doesn't show the Weekday just because there aren't any appointments for that day for the next few weeks (very rare situation in my opinion).
    It is still worth covering up for the not-so-obvious. You'll need to build a table in the database with a DateTime column that list all dates for perhaps the next two or more years and LEFT JOIN it to the existing ApptDateTime field. Throughout the report, wherever you've referenced the ApptDateTime field, replace that with the DateTime field from the new table.
    Once you have the above sorted out, you have some more work before the Crosstab is ready. Here's what you need to do (Steps work only for CR 2008 or higher):
    1) Add the record selection formula so that it gives the weekends a miss:
    Not(datepart('w',{DateTimeField}) IN [1,7])
    2) Create a formula called 'DayName' with this code:
    datepart('w',{DateTimeField})
    3) Insert the crosstab. Use the DateTime field as the Row and set it to the Print 'For each week' by clicking the options button
    4) Use the 'DayName' field as the Column > Click Group Options > Options tab > Click 'Customize Group Name field' > Click the formula button beside 'Use a formula' and use this code:
    WeekDayName(datepart('w',{DateTimeField}))
    5) Use the PatientNumber field as the Summarized Field and change the Summary to 'Count'
    6) Refresh the report and while in the Preview Mode, right-click the 'Total' Column > Select Column Grand Totals > Check 'Suppress Grand Totals'
    7) Right-click column header for 'Friday' and select Calculated Member > Insert Column. A blank column with zero values is inserted
    8) Right-click the blank header cell > Calculated Member > Edit Header Formula and type this:
    "Average # Appts"
    9) Next, Right-click one of the zero value cells in the newly added column > Calculated Member > Edit Calculation Formula and use this code:
    local numbervar i;   
    local numbervar avg;   
    local numbervar cnt;  
    for i := 0 to CurrentColumnIndex-1 do   
        avg := avg + (GridValueAt(CurrentRowIndex, i, CurrentSummaryIndex);   
        cnt := cnt + 1;   
    avg/cnt;
    Let me know how this goes.
    -Abhilash

  • "Are you sure you want to leave this page?" on saving Publishing Page

    Hi all,
    we're getting some ... interesting ... behavior in IE.
    Setup:
    We have a page layout based on some content type. Both contain (besides other fields) a DateTimeField which is shown in edit mode.
    When a user clicks "Save" after editing the page, he is presented a modal dialog saying "Are you sure you want to leave this page?" with the options to "stay" or "leave".
    When a user clicks "leave" the following behaviour is as expected (changes are saved, page is working). When a user clicks "stay" he sometimes gets prompted for conflicts.
    As soon as the DateTimeField is removed from the page layout (but is kept in the content type) there are no more such pop-up dialogues.
    This happens only in IE 9/10/11. FF and Chrome work fine.
    Do you have any suggestions, on how to fix this? Not the conflicts part, but the fact that this dialogue box is shown at all.
    - Ben
    Code
    Field Definition
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Field
    ID="{401b4dad-f4db-45a8-a111-42ed278a3298}"
    Name="FI_Erstellungsdatum"
    DisplayName="MyDate"
    Type="DateTime"
    Required="TRUE"
    Group="MyGroup"
    Format="DateOnly">
    <Default>[Today]</Default>
    </Field>
    </Elements>
    Reference in Content Type
    <FieldRef ID="{401b4dad-f4db-45a8-a111-42ed278a3298}" DisplayName="MyDate" Required="TRUE" Name="FI_MyDate" Format="DateOnly" />
    Reference in Page Layout
    <SharePoint:DateTimeField FieldName="401b4dad-f4db-45a8-a111-42ed278a3298" runat="server"></SharePoint:DateTimeField>
    Internet Explorer
    I already tried seeting IE (Security) Settings back to deafault and disabling add-ons. It did not help.
    The site is accessed via https and is in the Trusted Sites list in IE.

    Hi SomeTallGuy,
    According to your description, my understanding is that the model dialog appears after you click Save.
    My suggestion as below:
    1. Set the Internet Explorer Security Setting to low.
    2. If you have add your site to trusted sites, try to delete all the browser data, such as cookie, temporary files to test whether it works.
    Best regards,
    Zhengyu Guo
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Zhengyu Guo
    TechNet Community Support

  • Converting a date time to a date only

    Post Author: Dockman
    CA Forum: Formula
    I am working on a report that has a running total field.  The running total field keeps a running total and resets every time that a date changes.  the problem is that my dates include times, therefore the running total resets on every line.  How can I convert my date (in date time format) to be only a date so that it does not reset on every line?
    Obviously, I am not a programmer so I apologize if this is a stupid question.

    Post Author: yangster
    CA Forum: Formula
    if you are doing it inside crystal you can use the date functiondate({your.datetimefield})if you are doing it at the db level in a command this will vary depending on your db

  • Date() format in Livecycle designer

    Hello All
    I have a requirement where in I should display the date/time in a seperate field when the user starts typing in a text field.
    I have the following code in the change event of text field in which user types:
    datetimefield.rawValue=Date();
    datetimefield is a Date/Time field with value type 'calculated- Read Only' and display pattern of  date{yyyy-mm-dd} time{hh:mm:ss}
    Under the binding tab, the data form is set to 'Date and Time'
    Now, when start typing in the text field, the date and time is displayed however, not in the format I want.
    I am getting output as 'Wed Apr 15 2009 14:18:51 GMT-0400 (Eastern Daylight Time)'
    I want the output to be 'Wed Apr 15 2009 14:18' or something similar. I donot want the <SS> and GMT information.
    Appreciate any help.

    Old thread but thought I would answer to help others.
    What he wanted was to go back to the field tab of the object inspector and edit the display pattern and the data pattern.

  • How to group data at granularity level hours and every 10 minutes?

    I have sales table imported from SQL server. The date columns are are captured at granularity level such as 30-12-2013 16:50:16. 
    what is best way create master date table, and create relationship between the sales table and the master date table?
    I am new in Power Pivot, and any complete detailed steps and links will be appreciated
    Note: just clarify the requirements. The business wants to see how much sales a consultant sells in  every 10, 30 minutes during normal business hour.
    Hope this help
    jl

    Split your field:
    1) A date portion related to your date dimension at the day grain
    2) A time portion related to your time dimension at a 10 minute grain.
    In TSQL:
    SELECT
    ,[Date] = CAST( <datetimefield> AS DATE) -- date with no time
    ,[Time] = CAST( '18991230 '
    + RIGHT('0' + DATENAME(Hour, <datetimefield>), 2) + ':'
    + RIGHT( '0' + CAST( (DATEPART(MINUTE, <datetimefield>) / 10) * 10 AS NVARCHAR(2)), 2) + ':'
    + '00' AS DATETIME)
    Write this in your query to populate the fact table. This will give you a field holding just the date, and one holding the time at a 10 minute granularity.
    A date table is trivial to produce in SQL or in Excel.
    Here's a link for doing a very basic one in SQL Server.
    A time table is trivial as well:
    WITH TimeCTE ([Time]) AS
    (SELECT CAST('18991230 00:00:00' AS DATETIME)
    UNION ALL
    SELECT DATEADD(MINUTE, 10, [Time])
    FROM TimeCTE
    WHERE [Time] < CAST('18991230 23:50:00' AS DATETIME)
    SELECT * FROM TimeCTE OPTION(MAXRECURSION 0)
    This gives you the beginnings of a dimension with time intervals every 10 minutes.
    You can extend this table with TSQL functions or DAX calculated columns, whichever you find more convenient.
    Then, you can join your <fact table>[Date] to <date dimension>[Date], and your <fact table>[Time] to <time dimension>[Time], and do all of your filtering on those tables.
    Note: I have used a full datetime field for the time dimension above. This is because Power Pivot/Tabular only know datetime as a data type. If you want to add time to a date, the time portion must be recorded on 1899-12-30 to achieve the desired result.
    When importing a TIME data type into the Tabular model, the field is assigned the date of processing, which is absurdly annoying.

  • Date field patterns and barcodes

    I have a date field that is mapped to a barcode.  the date field has a pattern > Data of date {YYYYMMDD} because the target system requires it without the dashes.
    However when the barcode generates it always encodes YYYY-MM-DD (ie. WITH THE DASHES). 
    If i do a xfa.host.messageBox (this.rawValue) it always displays the YYYY-MM-DD. 
    If I call the this.formattedValue it does return YYYYMMDD.
    To fix this i created a hidden field which i wrote to on the exit of the datefield and mapped this hidden field to the barcode.
         hiddenField.rawValue = this.formattedValue
    Is there a better way to do this without the hidden fields?  I ask since i have a bunch of date fields..
    How/where do i change the pre-generated barcode code to grab the formattedValue instead of the rawValue if its a datetimefield?

    Hi,
    Got the answer for the first question from http://forums.adobe.com/message/4282353#4282353.
    Kindly help with the validation message part.
    Thanks

Maybe you are looking for

  • Issues with Cisco Prime LMS 4.2.3

    Hi, I'm trailing Cisco Prime LMS 4.2.3 Soft appliance on ESXi before I deploy it into a live environment and am having some issues. I've upgraded to version 4.2.3 and the box was working fine after the upgrade however on power it up today the Apache

  • HP LaserJet P1102w -- Paper Creasing

    I just purchased a new HP Laserjet P1102w printer this afternoon. After setup it prints fast and nice clear pages, but I noticed something strange. It makes creases in the paper. It's not really noticable, but if I hold a printout up and tip it in th

  • SwitchDynamicStreamIndex doesn't work

    Hi, i try to set the StreamingItem of a video manually. But in my code the method switchDynamicStreamIndex has no impact at all. The index always stays at position 0. What am I doing wrong? Here is my code: <code> mediaFactory = new DefaultMediaFacto

  • Question regarding having two keyfigures in one line

    Hello I  have a requirement. I need values of two keyfigures from one cube in one row in the BEX Report. Basically depending on the month i want 6 months of history keyfigure value and 12 months of forecast keyfigure value in BEX reporting in one row

  • Need to stop processing at portal

    is it possible through workflow to stop processing further from portal and through message at portal itself. examepl, wen emp applying leave, wen he doesnt has sufficient balance to apply leave, is it possible to throw error message at portal and blo