How to load a saved xml with userqueries and favourites?
I have saved a XML file using UserQueries.ExportToXML(...) and it looks good.
The file contains my favourites and the folders as well as the userqueries.
My problem is now to load it when opening a server connection.
I tried
UserQueries.ImportFromXML(...)
QueryBuilder.MetadataStructure.ImportFromXML(...)
Using UserQueries.ImportFromXMl shows me the error
"Exception: Incorrect xml schema: unexpected element "metadata_type" at line 15, pos 89"
When using QueryBuilder.MetadataStructure.ExportFavouritesToXML and ImportFavouritesFromXML it works fine, except I get no userqueries.
I'm using AQB 3.9.2.2234 in VS2022 in a VB.Net Basic Winform.
I wanted to add my XML file, but I could not add it to this post
Hi Andrey,
thank you so much. Things could be so easy.
During my tests I was quite close to that (saving in 2 files), but I missed one important thing.
That was the
Hello Werner,
seems you use the right methods, but not sure about your "container, structure, file" part.
Let me explain. If you turn "User Queries" pane on, there is additional UI tree control for user queries.
So there are two separate metadata structures: one for the main "database objects tree" (with favorites), and one for "user queries tree".
To save both "Favorites" and "User Queries" you should save both structures:
To load saved structures back:
Hi Andrey,
thank you. Now the error has gone, but I'm still not able to load user queries.
I use UserQueries.ExportToXML(container,structure,file) and UserQueries.ImportFromXML(container,structure,file)
The favourites are loaded but no user query. The debugger shows me the user queries in the metadatacontainer along with the server databases (here item 13 is my user query, the others are SQL databases).
Did I miss something? Maybe some extra assignment/refreshing etc.?
Hello Werner,
This bug is fixed in the new version 3.9.5.
Hello Werner,
Thank you for your question.
We will investigate this issue and let you know about result shortly.
Here is my XML (the 2 lines <user_data> are cut on the right)