Search Condition returning wrong data type error

Hi,

I'm trying to create a UIX app which shows a dashboard and do logic with objects and properties.

I'm doing a search condition to filter by object type but it's saying Wrong data type.

CustomControlSite.cpp, 1049, Wrong data type. (0x8004000F)
MyDashboard: dashboard.html, 31, Wrong data type. (0x8004000F)
MDispatchExImpl.h, 679, Wrong data type. (0x8004000F)
MDispatchExImpl.h, 841, Wrong data type. (0x8004000F)
CoTypedValue.cpp, 368, Wrong data type. (0x8004000F)
MF_TypedValue.cpp, 4031, Wrong data type. (0x8004000F)
(M-Files 24.1.13312.10 2024-01-31T08:47:37.812Z)

Below is my code

		function OnNewDashboard(dashboard)
		{
            var searchConditions = new MFiles.SearchConditions();
            
			var searchCondition = new MFiles.SearchCondition();
			searchCondition.Expression.DataStatusValueType = MFiles.MFStatusType.MFStatusTypeObjectTypeID;
			searchCondition.ConditionType = MFiles.MFConditionType.MFConditionTypeEqual;
			searchCondition.TypedValue.SetValue(MFiles.MFDataType.MFDatatypeLookup, 205); //Line throwing error
			searchConditions.Add(-1, searchCondition);

            var searchResults = dashboard.Vault.ObjectSearchOperations.SearchForObjectsByConditions(searchConditions, MFiles.MFSearchFlags.MFSearchFlagNone, false);

			document.getElementById("myID").innerHTML = searchResults.Count;
		}

It also doesn't like it when I use Expression.SetStatusValueExpression or Expression.SetPropertyValueExpression saying type mismatch.

Is it the way I've configured my dashboard?

Thanks,

Harold

Parents
  • Pasi from M-Files has found the solution.

    try shortening to following as it looks like that there was kind of duplicate ".MFStatusType" etc in each row.

                var searchCondition = new MFiles.SearchCondition();
                searchCondition.Expression.DataStatusValueType = MFiles.MFStatusType.ObjectTypeID;
                searchCondition.ConditionType = MFiles.MFConditionType.Equal;
                searchCondition.TypedValue.SetValue(MFiles.MFDataType.Lookup, 205); //Line throwing error
                searchConditions.Add(-1, searchCondition);

     

Reply
  • Pasi from M-Files has found the solution.

    try shortening to following as it looks like that there was kind of duplicate ".MFStatusType" etc in each row.

                var searchCondition = new MFiles.SearchCondition();
                searchCondition.Expression.DataStatusValueType = MFiles.MFStatusType.ObjectTypeID;
                searchCondition.ConditionType = MFiles.MFConditionType.Equal;
                searchCondition.TypedValue.SetValue(MFiles.MFDataType.Lookup, 205); //Line throwing error
                searchConditions.Add(-1, searchCondition);

     

Children
No Data