Skip to main content

Search

Strange behaviour with GetFirstValueForQuery

Comments

13 comments

  • Matthias Walter

    Hi Jelle Dijkstra,

    unfortunately I'm not able to reproduce your issue. On my env it's only executed once.

    Can you provide more details about your configuration?

    Is it on a display, new or editform?

    Do you have configured a condition?

    Which version of rich forms is installed? SP2013, right?

     

    Kind regards

    Matthias

    0
  • Jelle Dijkstra

    Hi Matthias Walter,

     

    It is in my editform. I guess it is not the CAML query but somethin else.

    I also tried other scripts (validations / calculated actions) but the form stays in the status "Working on IT".

    Looks like the focus is not coming back to the edit form and keeps "Working on IT".

    With other forms on other sites I do not have the issue that is hangs in "Working on IT".

     

    When I try something simple like below in a calculated expression it works in the poupwindow/test window, but my editForm in Runtime hangs in "Working on IT" and I can only get out of the form by Cancel the edit.

    var total = 0;

    if ([[@SubLists.RequestLines.EstimatedContractCost.Sum]]> 0)
    {
     var conversion = Number([[ConversionRateUsed]]);
     var amount = Number([[@SubLists.RequestLines.EstimatedContractCost.Sum]]);
     total = amount / conversion;
        total = Math.round(total,0);

    return total;

    -

    -- script:

     

    Any suggetsions/ Ideas ,what to check? 
    I already copied entire site to another sitecollection, but no luck.

    0
  • Matthias Walter

    Can you please check in the dev tools (F12) if there are any errors? Normally this is the case when it is not stopping with "working on it".

     

    Regards

    Matthias

    0
  • Jelle Dijkstra

    Matthias Walter,

    Matthias I had a look on the console logging in Chrome and found something strange which was happening in the runtime. I got the below error message;

    I see the skybowexpressionbuilder script is loaded/ran with version 3.1.27.8,
    FYI: we started building with version 3.1.27.8 but in the meantime we upgraded to the most recent version 3.1.27.22...
    What to do to get it ran/executed to the latest version?

     

    Once this error is thrown (after hitting first time the button with the script to be executed) the status "Working on IT" is shown, but when I hit again the button the script is executed well and showing me the expected results. So to me it looks like, something is not loaded well at first.

    Looking at/in the designmode of the Skybow Editfor, to test the script I see also that at first above error message is shown, but this is when I select a record to test my script on. If I click test afterwards the script is executed well.
    So in designtime the error also occurs, but this is not really visible because it is solved when actually performing a test on a selected record

    Select record to test script with. After selecting and click on Test first error is shown

     

    Once the record is loaded in testscreen and when I hit again test, the script is well executed.

    Based on above I think something is missing/not loaded well at start, but how to get that solved ?

    Thanks for your support.

    0
  • Jelle Dijkstra

    Additional information:

    we are using RichForms on SharePoint 2013. ( I do not see that we have a resource file ms.rte.js  , can this be the problem)?

    0
  • Matthias Walter

    For a proper update you need to open the app homepage again after updating the app on a site.

    See important note here at the bottom: How to install and update a skybow SharePoint Add-In 

     

    If it is still using the older version navigate to ~site/FormsStoreLibrary/Scripts and check the file versions there:

    If they are not the latest, delete the file appsettings.txt and navigate to the app homepage again, which will create this file and script files should be updated to the latest version.

     

    BR Matthias

    0
  • Jelle Dijkstra

    Hi Matthias Walter,

     

    opening the app homepage again did solve the version issue. It is now opening in the right version, but I still do have the same problems as described above.

    After twice clicking the button with a executescript action behind it , the script is well executed.

     

     

     


    Any ideas, suggestions how to resolve?

     

    BR.

    Jelle

    0
  • Matthias Walter

    Great to hear with the versions!

    Your error might be with that part of the CAML query:
    <Contains><FieldRef Name="Country" /><Value Type="TaxonomyFieldTypeMulti">[[BusinessUnits.Country]]</Value></Contains>

    Is your "Country" field a multi term store column? Does it work if you remove that part of the query?

     

    BR Matthias

    0
  • Jelle Dijkstra

    Matthias,

     

    thanks again. I already changet the column type from Multi term to lookup but still the error occurs.

    I now have build the query again, bit-by-bit and it seems that the contains operator is failing.

    Any suggestions how to check whether a value is in a multilookupvalue in a CAML query ?

     

    Despite the above, the query will runs when you run it for the second time .. .. strange behaviour.

     

    BR.

    Jelle

    0
  • Matthias Walter

    To search in multi lookups you need to use the <in> node instead of <contains> like this:

    <Where><And><In><FieldRef Name="Contacts" /><Values><Value Type="Text">Christof Nussbaumer</Value><Value Type="Text">Matthias Walter</Value></Values></In></And></Where>

    BR Matthias

    0
  • Jelle Dijkstra

    It turned out it is not the contains operator but the Expression Variable (Placeholder)  [[BusinessUnit.Country]] which cannot be parsed in the query.

    Entering a hardcoded value was working, so now looking for a workaround to get the query validated to a variable.

    0
  • Matthias Walter

    Is it spelled BusinessUnit or BusinessUnits? Is this a standard single lookup?

    how about [[=[[BusinessUnit.Country]] ]]?

    0
  • Jelle Dijkstra

    The parsing/execution of contains and [[BusinessUnits.Country]] does not work properly.

    So I changed the query to an IN Operator which executes well with hardcoded values.

    Now I am looking how to contruct the variable 'VALUES' part of the IN parameter.

    I want to build the CAML-query dynamically, but how to pass the javascript variable to the CAML query : GetFirstValueForQuery:

     

     

     

    var BUCountries = [[BusinessUnits.CountryText]];
    var valueText = '';
    for (var i = 0; i < BUCountries.length; i++)

      valueText = valueText.concat('<Value Type="Text">',BUCountries[i],'</Value>');
      }
    valueText = '<Values>' + valueText + '</Values>';

     

    I want to pass the variable valueText within the CAML query of my GetFirstValueForQuery operation. How to achieve that?

    0

Please sign in to leave a comment.