ITLec / PowerQueryBuilder

13 stars 5 forks source link

unchecking all attributes still adds all attributes to the fetchxml on version 1.2018.1014.5 #24

Open bpankin opened 5 years ago

bpankin commented 5 years ago

this is causing ram issues for my computer

hanksteen commented 5 years ago

I have the same issue in 1.2019.423.8.

hanksteen commented 5 years ago

I believe my issues has to do with the hard coded value of 25 attributes in FetchXmlQuery.cs row 176: attributeNameStep1 = (powerQueryAttributeList.Count > 25) ? " <all-attributes />" : attributeNameStep1;.

When I test one entity with 16 attributes in the Selected fields I get a query with the attributes specified. If I select one more attribute I get "all-attributes". (The 16 selected attributes contains lookups, etc. so it will end up in more attributes in the actual fetch).

UlrikBC commented 5 years ago

There's a character limit in FetchXML, and you will get an error if you exceed that amount. The tool was set to switch to all-attributes when a certain number of fields were added. Basically to avoid hitting that error. Now, that precaution won't necessarily always be 100% correct, as different attributes have different character lengths. So if you have a lot of short field names, you can stack a lot more fields in there before needing the all-attributes feature. Not exactly sure how we can improve this, but we are looking in to it, and ideas are welcome. This could be as simple as just showing why it was defaulted to all-attributes.

hanksteen commented 5 years ago

Ahh, I was not aware of that.

I tried to find the limit in FetchXml, but couldn't. Do you know what it is?

In your code, with just a short review, it looks like the entire fetch gets created before the check on 25 attributes are made. Maybe it would make sense to check the length of attributeNameStep1 compared to the limit instead?

And as you suggest, it would be great to show that all-attributes was used because query length exceeded the maximum allowed length.

And to start telling the consultants to created fields named xyz_a1, xyz_a2, ... in Dynamics instead of long readable names ;).

UlrikBC commented 4 years ago

Working on some updates and wanted to find the precise limit, but in my testing it seems that the limit is either gone have been increased significantly. So we will take that into account in the next update.