1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Error retrieving Form description

Error retrieving Form description

3 posts, 1 answered
  1. Jaap
    Jaap avatar
    10 posts
    Registered:
    23 Oct 2012
    19 Oct 2011
    Link to this post
    Hello,

    I my control I use this statement:
                if (!string.IsNullOrEmpty(FormName))
                {
                    using (var formsManager = FormsManager.GetManager())
                    {
                        var formDescription = formsManager.GetForms().Where(f => f.Name == FormName).SingleOrDefault();
                       ......
                     }
                 }
    This works fine with Sitefinity 4.2.
    But with Sitefinity 4.0 it gives the following error:

    line 1:136: unexpected token: ["",<1>,line=1,col=136]
    Original Query: DEFINE EXTENT extnt FOR Telerik.Sitefinity.Forms.Model.FormDescription; SELECT * FROM extnt AS t1 WHERE t1.appName = $1 AND t1.name =


    [QueryException: line 1:136: unexpected token: ["",<1>,line=1,col=136]
    Original Query: DEFINE EXTENT extnt FOR Telerik.Sitefinity.Forms.Model.FormDescription; SELECT * FROM extnt AS t1  WHERE t1.appName =  $1 AND t1.name =]
       Telerik.Sitefinity.Data.Linq.Oql.OqlQueryProvider`2.ExecuteKnownType(IObjectScope scope, String queryText, Boolean isEnumerable, Int32 skip, Int32 take, IList parameters, ElementOperator op) +1026
       Telerik.Sitefinity.Data.Linq.Oql.OqlQueryProvider`2.Execute(Expression expression) +585
       Telerik.Sitefinity.Data.Linq.QueryProvider`2.System.Linq.IQueryProvider.Execute(Expression expression) +115
       System.Linq.Queryable.SingleOrDefault(IQueryable`1 source) +265
       Xperit.Sitefinity.Forms.FormsEntriesControl.InitializeControls(GenericContainer container) +815
       Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +58

    Somebody any idea how to solve this in 4.0?

    Thanks, Jaap
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    24 Oct 2011
    Link to this post
    Hello Jaap,

    Can you please let us know if FormName is the programmatic name of the form or its title that you've given when you created it? You can use the GetFormByName() method that should successfully return the form by its programmatic name:
    var manager = FormsManager.GetManager();
    var form = manager.GetFormByName("sf_myform");        
    I've recorded a short video demonstrating how the code works on one of my Sitefinity 4.0 SP1 projects, please find it attached to this reply as well.

    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Jaap
    Jaap avatar
    10 posts
    Registered:
    23 Oct 2012
    24 Oct 2011
    Link to this post
    Yes, GetFormByName solves the problem with Sitefinity 4.0.
    Seems the linq query does not work fine with 4.0.

    Jaap
3 posts, 1 answered