<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5494062667728592876</id><updated>2024-09-24T20:56:46.859-07:00</updated><category term="AX"/><category term="Copy"/><category term="Excel"/><category term="Extended Table Browser"/><category term="Filters"/><category term="Inquiries"/><category term="Microsoft Dynamics AX"/><category term="Open"/><category term="Open Table"/><category term="Paste"/><category term="Print"/><category term="Queries"/><category term="Save"/><category term="Table Browser"/><category term="Table-Browser"/><title type='text'>AXAPTIAN - Microsoft Dynamics AX Blog</title><subtitle type='html'>Blogs &amp;amp; code stuff are based on my research &amp;amp; development work. I try my best to publish the safe material. Applying of code in production environment is at your own risk. You can experiment/test my code and then apply for your necessities with care.&#xa;&#xa;For discussions contact: axaptian@gmail.com</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://axaptian.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5494062667728592876/posts/default'/><link rel='alternate' type='text/html' href='http://axaptian.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>AXAPTIAN</name><uri>http://www.blogger.com/profile/09417321600735158979</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5494062667728592876.post-8134508022048433848</id><published>2010-02-14T11:58:00.000-08:00</published><updated>2010-02-14T13:08:11.829-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AX"/><category scheme="http://www.blogger.com/atom/ns#" term="Copy"/><category scheme="http://www.blogger.com/atom/ns#" term="Excel"/><category scheme="http://www.blogger.com/atom/ns#" term="Extended Table Browser"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Dynamics AX"/><category scheme="http://www.blogger.com/atom/ns#" term="Open"/><category scheme="http://www.blogger.com/atom/ns#" term="Open Table"/><category scheme="http://www.blogger.com/atom/ns#" term="Paste"/><category scheme="http://www.blogger.com/atom/ns#" term="Print"/><category scheme="http://www.blogger.com/atom/ns#" term="Table Browser"/><category scheme="http://www.blogger.com/atom/ns#" term="Table-Browser"/><title type='text'>Easy Extended AX Table-Browser</title><content type='html'>&lt;strong&gt;Easy Extended AX Table-Browser&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
During implementations and regular developments in AX, I observed that many consultants/developers open the tables from AOT in the Table-Browser and by hand attempt to add/delete the records by hitting Ctrl+N/Alt+F9 keys and often copies the records from the table-browser and paste them to excel for checking/saving/printing/... the table data. The distress of manually copying/pasting of records&amp;nbsp;and recalling the control-keys can be avoided by simply extending the Table-Browser by adding the Standard data Toolbar to the form&lt;br /&gt;
&lt;br /&gt;
Step-1: Go to the AOT and select \Forms\SysTableBrowser\Designs\Design&lt;br /&gt;
and then change the design property WindowType value from “Popup” to “Standard” &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgunXsTTGkQRe8ohbu9uZseDrVfBPYAR211L1tsM4kKp3yuUWZSa_M2tEOsyx2jH6bd_kdX7ZQiRFAKtkolxGZK-0r27-wdVklGiM90f8E5U8Kc8r0i5Q0c30VV5HVI5ptu4aLxwBLEZRHs/s1600-h/Fig1-AX-TableBrowser-Properties.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ct=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgunXsTTGkQRe8ohbu9uZseDrVfBPYAR211L1tsM4kKp3yuUWZSa_M2tEOsyx2jH6bd_kdX7ZQiRFAKtkolxGZK-0r27-wdVklGiM90f8E5U8Kc8r0i5Q0c30VV5HVI5ptu4aLxwBLEZRHs/s320/Fig1-AX-TableBrowser-Properties.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Fig1: Changing WindowType property value to “Standard”&lt;br /&gt;
&lt;br /&gt;
Step-2: Save and compile the SysTableBrowser Form after changing the WindowType property value&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi26vH0RZPuYqaLPvRdm_wMUt7SrwOfrIOtFWAmPs_HwSg35xZg1XNdqWx9L-Ha2qfojLa21eWB9_h4wGfo6fa-6pxWI3Emt2_sbYZxYt0CwQfSS7tk5zoxyEDfhyGXuiLOshciTuA29Ght/s1600-h/Fig2-AX-TableBrowser-Original.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ct=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi26vH0RZPuYqaLPvRdm_wMUt7SrwOfrIOtFWAmPs_HwSg35xZg1XNdqWx9L-Ha2qfojLa21eWB9_h4wGfo6fa-6pxWI3Emt2_sbYZxYt0CwQfSS7tk5zoxyEDfhyGXuiLOshciTuA29Ght/s320/Fig2-AX-TableBrowser-Original.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Fig2: The original Table-Browser (WindowType property is “Popup”)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFy3GIxAysKZdJPUiMM7hAWxbcsifjiu7PBkohUX7HaIdadJQ3hrz9RDNrbR2LvSlcutxLMg-2W8A1la4uJvJmff_fvx8voEFXOGZQ3xLDu_St8ws1auHIuDHlIsLBY66Rd-3R-XQVEhSr/s1600-h/Fig3-AX-TableBrowser-Extended.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ct=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFy3GIxAysKZdJPUiMM7hAWxbcsifjiu7PBkohUX7HaIdadJQ3hrz9RDNrbR2LvSlcutxLMg-2W8A1la4uJvJmff_fvx8voEFXOGZQ3xLDu_St8ws1auHIuDHlIsLBY66Rd-3R-XQVEhSr/s320/Fig3-AX-TableBrowser-Extended.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Fig3: Easy Extened Table-Browser with Standard-Toolbar (WindowType property is “Standard”)&lt;br /&gt;
&lt;br /&gt;
That’s it, enjoy the easy extended table-browser with the standard toolbar with all table/record action features&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Enjoy…AXAPTIAN&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;http://axaptian.blogspot.com/&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://axaptian.blogspot.com/feeds/8134508022048433848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://axaptian.blogspot.com/2010/02/easy-extended-ax-table-browser.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5494062667728592876/posts/default/8134508022048433848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5494062667728592876/posts/default/8134508022048433848'/><link rel='alternate' type='text/html' href='http://axaptian.blogspot.com/2010/02/easy-extended-ax-table-browser.html' title='Easy Extended AX Table-Browser'/><author><name>AXAPTIAN</name><uri>http://www.blogger.com/profile/09417321600735158979</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgunXsTTGkQRe8ohbu9uZseDrVfBPYAR211L1tsM4kKp3yuUWZSa_M2tEOsyx2jH6bd_kdX7ZQiRFAKtkolxGZK-0r27-wdVklGiM90f8E5U8Kc8r0i5Q0c30VV5HVI5ptu4aLxwBLEZRHs/s72-c/Fig1-AX-TableBrowser-Properties.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5494062667728592876.post-3376392054766158678</id><published>2010-01-31T01:08:00.000-08:00</published><updated>2010-01-31T01:26:44.842-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AX"/><category scheme="http://www.blogger.com/atom/ns#" term="Copy"/><category scheme="http://www.blogger.com/atom/ns#" term="Filters"/><category scheme="http://www.blogger.com/atom/ns#" term="Inquiries"/><category scheme="http://www.blogger.com/atom/ns#" term="Queries"/><category scheme="http://www.blogger.com/atom/ns#" term="Save"/><title type='text'>Save/Copy the Filters/Queries/Inquiries to other users in AX</title><content type='html'>Blogs &amp;amp; code stuff are based on my research &amp;amp; development work. I try my best to publish the safe material. Applying of code in production environment is at your own risk. You can experiment/test my code and then apply for your necessities with care. &lt;br /&gt;
&lt;br /&gt;
Hi,&lt;br /&gt;
This is my first blog related to ERP system - Microsoft Dynamics AX&lt;br /&gt;
&lt;br /&gt;
While being new to AX I have started learning about it bit by bit.&lt;br /&gt;
I greatly appreciate that AX is truly extra-ordinary platform with full of flexibility and scaaaalability.&lt;br /&gt;
&lt;br /&gt;
This article is about copying the Filters/Queries/Inquiries to other users in AX&lt;br /&gt;
&lt;br /&gt;
In the early stage of implementation&amp;nbsp;we planned to share the filters/queries/Inquiries to other users. I was thinking how if we make &amp;amp; setup all the required filters initially and then start sharing them to the needed users and similarly users also wanted to share their queries to each other on daily basis.&lt;br /&gt;
&lt;br /&gt;
But alas, our implementation consultants clearly informed us, it is not possible to share the user queries/filters. The AX has not provided this feature by any means.&lt;br /&gt;
&lt;br /&gt;
Upon searching at AX forums, I found that many people wanted this feature but unfortunately no one has yet got any solution. Few posts suggested to use direct SQL statements in AX database to copy the query-data to the users usage-values in tables, this is workable solution and it can be done by only experienced database professionals but not viable to the end users for their regular needs.&lt;br /&gt;
&lt;br /&gt;
So friends here is the ultimate solution in AX&lt;br /&gt;
&lt;br /&gt;
I have written a safe method in AX for copying the Filters/Queries/Inquiries to other users&lt;br /&gt;
&lt;br /&gt;
It will allow the end-users to save/copy their filters/queries to other users simply and users does not require any technical awareness…&lt;br /&gt;
&lt;br /&gt;
Look at the following screens how the users will save their queries to other users:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRm9ORB5oqZbmE3gjYQHk6TubK4WPFMpXH1ZjrqX_nt29imOXZ5l6vnVBDoE29A3M9ooIVrwcENdrR9kK5VexZLdCJjhngJ2DLRUKZ0jTa_hEukixtqb80uZeUVvqQcrUs23liriJ8JVAk/s1600-h/Fig1-AX-Query-CopyToUser-SaveAs.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; kt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRm9ORB5oqZbmE3gjYQHk6TubK4WPFMpXH1ZjrqX_nt29imOXZ5l6vnVBDoE29A3M9ooIVrwcENdrR9kK5VexZLdCJjhngJ2DLRUKZ0jTa_hEukixtqb80uZeUVvqQcrUs23liriJ8JVAk/s400/Fig1-AX-Query-CopyToUser-SaveAs.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Fig1: Using the “Save as” option to save the query&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; kt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2pNEsxemihFLkdrQjA5AqGhRC8GrquEcViFWaBS5BlVDowQ6-nMbl065K9ftDbAq_cRak9vvDIuEDDXmcWoRHDceUasYpfaD1EQGWQgorllszmOtqSYV_uiafvrMs0yMfz_9MmFyZXO0O/s320/Fig2-AX-Query-CopyToUser-Enter-UserId.png&quot; /&gt;&amp;nbsp; &lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Fig2: Save Inquiry dialog now has “Copy To User” field&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYgSnWvQn407OZCz3ZlHIZ2jhCEqp40QJ6KAtHPf2FwUsrYUrDAKjhCP1i7kW8BC98AVYdRdMQNdawDvpZAwCMZsa_VW_0lzC_zB6J1oWmiNX2nao44qGMxh74Sr0WswuG5xfbjTYiFVpj/s1600-h/Fig3-AX-Query-CopyToUser-Select-UserId.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; kt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYgSnWvQn407OZCz3ZlHIZ2jhCEqp40QJ6KAtHPf2FwUsrYUrDAKjhCP1i7kW8BC98AVYdRdMQNdawDvpZAwCMZsa_VW_0lzC_zB6J1oWmiNX2nao44qGMxh74Sr0WswuG5xfbjTYiFVpj/s320/Fig3-AX-Query-CopyToUser-Select-UserId.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Fig3: Simply select/enter the desired user to copy the currently saving filter/inquiry&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwG9H9C9qNHzdnOHGx1_oEgJoe98z2qobPKh5j2UJdcZMDkl5q9-trK0lFIKG0A7P7XV-6ryq7j-HdUOKvZ9_jnLi1zJ1FBCry4Slid7MaCrGs9UM2gv7E_twmsU2suKvO30tbLxHN7T-w/s1600-h/Fig4-AX-Query-CopyToUser-Success.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; kt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwG9H9C9qNHzdnOHGx1_oEgJoe98z2qobPKh5j2UJdcZMDkl5q9-trK0lFIKG0A7P7XV-6ryq7j-HdUOKvZ9_jnLi1zJ1FBCry4Slid7MaCrGs9UM2gv7E_twmsU2suKvO30tbLxHN7T-w/s320/Fig4-AX-Query-CopyToUser-Success.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Fig4: Info dialog showing the query is successfully saved to the desired user&lt;/div&gt;&lt;br /&gt;
Now you can simply ask the beneficiary users to start enjoying the filter query you have copied to them&lt;br /&gt;
&lt;br /&gt;
If the selected user is already having the same-name query then the confirmation to overwrite the query will be shown. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGaL_oiCYvVjSIJv9OPXYNBo8BjPtYxA466KmfL3o_cY73bdJvj9VHOFOxzWTX3ZihupJJYaTMg7tAbVlEE_ClF-oRLBIP-rYk5Unlp7SoxT3Lk_L2mZdpaVJQGXeESRvL74f_kkhU0VJp/s1600-h/Fig5-AX-Query-CopyToUser-AskOverwrite.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; kt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGaL_oiCYvVjSIJv9OPXYNBo8BjPtYxA466KmfL3o_cY73bdJvj9VHOFOxzWTX3ZihupJJYaTMg7tAbVlEE_ClF-oRLBIP-rYk5Unlp7SoxT3Lk_L2mZdpaVJQGXeESRvL74f_kkhU0VJp/s320/Fig5-AX-Query-CopyToUser-AskOverwrite.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Fig5: Confirmation to overwrite if the filter/query is already exists in the beneficiary user&lt;/div&gt;&lt;br /&gt;
However the above situation will never arise because the target query name will be appended with audit-details while saving it to beneficiary user&lt;br /&gt;
&lt;br /&gt;
For safety &amp;amp; tracking and to avoid overwriting the beneficiary users queries, &lt;br /&gt;
&lt;br /&gt;
The target query-name will be appended with the audit details while being saved to the beneficiary users. Audit details such as concatenating the current-userid and current-datetime in the query-name, it will help the other users to know who saved the queries to them and when were they saved. Also it will avoid overwriting the users&#39; queries if they already have same named queries.&lt;br /&gt;
&lt;br /&gt;
Following figure shows all the queries saved to the beneficiary users furthermore showing who and when were these queries saved to them&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Us1HoWOU-Qqx7ckUNmr6BcuTchvatFrFiOFA6QZ6ChAyduRVy7Lwg0yqQTXvL6RWsScDvAPjv8AqfOOExJ3_ExFRsDPB5ZlJDMHQpjj40Ssxry9TaCQF1_ogi-PjLCumxWdj9ThEAFzL/s1600-h/Fig6-AX-Query-CopyToUser-FinalResult.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;246&quot; kt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Us1HoWOU-Qqx7ckUNmr6BcuTchvatFrFiOFA6QZ6ChAyduRVy7Lwg0yqQTXvL6RWsScDvAPjv8AqfOOExJ3_ExFRsDPB5ZlJDMHQpjj40Ssxry9TaCQF1_ogi-PjLCumxWdj9ThEAFzL/s400/Fig6-AX-Query-CopyToUser-FinalResult.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Fig6: The screen shows the queries saved to him by other user with their userid and datetime in the query-name&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Well friends look at the source code finally then…&lt;br /&gt;
Note: The solution is written and tested in Microsoft Dynamics AX 2009 with SP1.&lt;br /&gt;
The source code for saving filter/Inquiries to other users in X++&lt;br /&gt;
..&lt;br /&gt;
&lt;div style=&quot;border-bottom: blue outset; border-left: blue outset; border-right: blue outset; border-top: blue outset; color: black; font-size: xx-small; height: 500px; overflow: scroll;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: green;&quot;&gt;
//-------------------------------------------------------------------------------------------------------
//
//  Form:           SysQueryForm
//
//  Method:         saveQueryToUser
//
//  Parameters:     Name   _queryName     -- Name of the filter/inquiry
//                  UserID _saveToUserID  -- Beneficiary UserId to whom to copy the filter/inquiry
//
//  Retruns:        boolean [true for success, false for fail]
//
//  Description:    This method saves a copy of the filter/query to the other selected user.
//
//  Related Method: SysQueryForm.querySave is extened to accept the userid
//                  to save the copy of filter/query
//
//  Called From:    SysQueryForm.querySave
//
//-------------------------------------------------------------------------------------------------------
// saveQueryToUser - skf-28JAN2010
// Author          - skf@axaptian
//-------------------------------------------------------------------------------------------------------&lt;/span&gt;
private boolean saveQueryToUser(Name _queryName, UserID _saveToUserID)
{
    int i, j, beneficiaryUserQueryPackCount, currentUserQueryPackCount, sourceElementCount;
    boolean ok = true, break_outerloop = false;
    UserInfo userInfo;
    container sourceElement, beneficiaryUserQueryPack, currentUserQueryPack;
    str queryNameMAX;   &lt;span style=&quot;color: green;&quot;&gt;// full name with adding the audit values in the query-name&lt;/span&gt;
    str userIDandDT;    &lt;span style=&quot;color: green;&quot;&gt;// for audit (current-userid and current-system-datetime)&lt;/span&gt;
    Dictionary dict;
    DictType dictType;
    ;

 _queryName=strRtrim(strLtrim(_queryName));
 
    if(strlen(_queryName)==0)
        return false;

    _saveToUserID=strRtrim(strLtrim(_saveToUserID));

    &lt;span style=&quot;color: green;&quot;&gt;// simply ignore &amp;amp; return if the beneficiary-userid is current-userid or beneficiary-userid is empty&lt;/span&gt;
    if(_saveToUserID==curUserID() || strLen(_saveToUserID)==0)
        return false;

    &lt;span style=&quot;color: green;&quot;&gt;// simply ignore &amp;amp; return if the userid is not-valid&lt;/span&gt;
    select RecId from userInfo where userInfo.Id==_saveToUserID;
    if(!userInfo.RecId) 
    {
        &lt;span style=&quot;color: green;&quot;&gt;// info(strfmt(&#39;Cannot copy the query to user [%1], invalid user-id entered&#39;, _saveToUserID));&lt;/span&gt;
        return false;
    }

    currentUserQueryPack=this.pack();

    if(conLen(currentUserQueryPack)&amp;lt;2)
        return false;  &lt;span style=&quot;color: green;&quot;&gt;// for any reasons if the currentUserQueryPack is empty&lt;/span&gt;

    beneficiaryUserQueryPack = classfactory.lastValueGet(element.lastValueDataAreaId(),
                                                         _saveToUserID,
                                                         element.lastValueType(),
                                                         element.lastValueElementName(),
                                                         element.lastValueDesignName());
 &lt;span style=&quot;color: green;&quot;&gt;
    //-----------------------------------------------------------------------------------------------
    // for safety and tracking, adding the audit details to the beneficiary query-name
    // such as concatenating the current-userid and current-datetime in the query-name
    // it will help the other users to know who saved the query to them and when was it saved
    // also it will avoid overwriting the users&#39; queries if they already have same named queries
    // additionally, care should also be taken that Name-Field will not allow more than 60 characters
    // if the beneficiary-name length is more than Type-Length characters, 
    // then the query-name will be truncated to accomodate the audit values
    //-----------------------------------------------------------------------------------------------&lt;/span&gt;
    userIDandDT=strfmt(&quot;(%1-%2)&quot;,
                        curUserId(),
                        DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::utcNow(),
                                                          DateTimeUtil::getCompanyTimeZone()));

    queryNameMAX = strfmt(&quot;%1 %2&quot;, _queryName, userIDandDT);
    dict = new Dictionary();
    dictType = dict.typeObject(dict.typeName2Id(extendedtypestr(Name)));
    if(strlen(queryNameMAX)&amp;gt;=dictType.stringLen())
    {
        queryNameMAX = strfmt(&quot;%1 %2&quot;,
                              subStr(_queryName, 1, strlen(_queryName)-(strlen(queryNameMAX)-dictType.stringLen())),
                              userIDandDT);
    }
    &lt;span style=&quot;color: green;&quot;&gt;//-----------------------------------------------------------------------------------------------

    //-----------------------------------------------------------------------------------------------
    // check for the query-data in the beneficiaryed-user
    //-----------------------------------------------------------------------------------------------&lt;/span&gt;
    beneficiaryUserQueryPackCount = conLen(beneficiaryUserQueryPack);
    if(beneficiaryUserQueryPackCount&amp;lt;2) &lt;span style=&quot;color: green;&quot;&gt;// if the query data is not set in the beneficiary user&lt;/span&gt;
    { 
        &lt;span style=&quot;color: green;&quot;&gt;// set the beneficiaryUserQueryPack with initial queryset values&lt;/span&gt;
        beneficiaryUserQueryPack = [conPeek(currentUserQueryPack, 1), conPeek(currentUserQueryPack, 2)];
        beneficiaryUserQueryPackCount = conLen(beneficiaryUserQueryPack);
    }

    &lt;span style=&quot;color: green;&quot;&gt;//-----------------------------------------------------------------------------------------------
    // check for the query-already-exists in the beneficiaryed-user
    //-----------------------------------------------------------------------------------------------&lt;/span&gt;
    for (i=1; i&amp;lt;=beneficiaryUserQueryPackCount; i++)
    {
        if(typeof(conPeek(beneficiaryUserQueryPack, i))==Types::Container)
        {
            sourceElement = conPeek(beneficiaryUserQueryPack, i);
            sourceElementCount = conLen(sourceElement);
            for (j=1; j&amp;lt;=sourceElementCount; j++)
            {
                if(typeof(conPeek(sourceElement, j))==Types::String)
                {
                    if(conPeek(sourceElement, j)==queryNameMAX)
                    {
                        &lt;span style=&quot;color: green;&quot;&gt;// confirm to overwrite the query for the selected user&lt;/span&gt;
                        if(Box::yesNo(strfmt(&quot;Saving Query To User [%1]\n\n&quot;, _saveToUserID) + 
                                             strfmt(&quot;@SYS55302&quot; + &#39;\n\n&#39;, _queryName) + 
                                             strfmt(&#39;%1%2&#39;, &quot;@SYS3074&quot;, &#39;?&#39;), DialogButton::Yes) == DialogButton::No)
                        {
                            ok = false;
                        }
                        else
                        {
                            beneficiaryUserQueryPack = conDel(beneficiaryUserQueryPack, i, 1);
                        }

                        break_outerloop = true;
                        break;
                    }
                }
            }
            if(break_outerloop==true)
                break;
        }
    }
    &lt;span style=&quot;color: green;&quot;&gt;//-----------------------------------------------------------------------------------------------


    //-----------------------------------------------------------------------------------------------
    // if everything is ok, then save the query to beneficiary-user
    //-----------------------------------------------------------------------------------------------&lt;/span&gt;
    if(ok==true)
    {
        break_outerloop = false;
        currentUserQueryPackCount = conLen(currentUserQueryPack);
        for (i=1; i&amp;lt;=currentUserQueryPackCount; i++)
        {
            if(typeof(conPeek(currentUserQueryPack, i))==Types::Container)
            {
                sourceElement = conPeek(currentUserQueryPack, i);
                sourceElementCount = conLen(sourceElement);
                for (j=1; j&amp;lt;=sourceElementCount; j++)
                {
                    if(typeof(conPeek(sourceElement, j))==Types::String)
                    {
                        if(conPeek(sourceElement, j)==_queryName)
                        {
                            // beneficiaryUserQueryPack += [conPeek(sourceElement, 1), conPeek(sourceElement, 2)];
                            beneficiaryUserQueryPack = conins(beneficiaryUserQueryPack,
                                                  conLen(beneficiaryUserQueryPack)+1,
                                                  [queryNameMAX, conPeek(sourceElement, 2)]);

                            classfactory.lastValuePut(beneficiaryUserQueryPack,
                                                      this.lastValueDataAreaId(),
                                                      _saveToUserID,
                                                      this.lastValueType(),
                                                      this.lastValueElementName(),
                                                      this.lastValueDesignName());
                            // info(strfmt(&#39;The Filter/Query [%1] is saved to user [%2]&#39;, queryNameMAX, _saveToUserID));
                            return true;
                        }
                    }
                }
            }
        }
    }
    &lt;span style=&quot;color: green;&quot;&gt;//-----------------------------------------------------------------------------------------------&lt;/span&gt;

    return false;

}

&lt;span style=&quot;color: green;&quot;&gt;//---[EOM: saveQueryToUser ]-----------------------------------------------------------------------------&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;..&lt;br /&gt;
&lt;div style=&quot;border-bottom: blue outset; border-left: blue outset; border-right: blue outset; border-top: blue outset; color: black; font-size: xx-small; height: 500px; overflow: scroll;&quot;&gt;&lt;pre&gt;&lt;div style=&quot;background-color: lightgrey;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;//-------------------------------------------------------------------------------------------------------
//
//  Form:           SysQueryForm
//
//  Method:         querySave
//
//  Parameters:     LabelType _name
//                  boolean _updateDropDownBox
//
//  Retruns:        void
//
//  Description:    This method is extended to allow the user to save a copy of the
//                  filter/query to the other selected user.
//
//  Related Method: SysQueryForm.saveQueryToUser, it saves the copy of filter/query to other users
//
//  Calling :       SysQueryForm.saveQueryToUser
//
//-------------------------------------------------------------------------------------------------------
// Extened Author - skf@axaptian - 28JAN2010
//-------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;public void querySave(LabelType _name = &#39;&#39;, boolean _updateDropDownBox = true)
{
    Dialog          saveDialog;
    DialogField     dialogField;
    boolean         validate;
    Name            name;

    &lt;span style=&quot;background-color: lightgrey;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------
    // variables applies to saveQueryToUser skf@28JAN2010
    // --------------------------------------------------------------&lt;/span&gt;
        DialogField     dialogField_userid;
        UserID          dialogField_userid_value;
    &lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;

    if (_name)
    {
        validate = false;
        name     = _name;
    }
    else
    {
        validate   = true;
        saveDialog = new Dialog();
        saveDialog.caption(&quot;@SYS26193&quot;);
        dialogField = saveDialog.addField(typeid(Name));

        &lt;span style=&quot;background-color: lightgrey;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------
        // applies to saveQueryToUser skf@28JAN2010
        // --------------------------------------------------------------&lt;/span&gt;
            dialogField_userid = saveDialog.addField(typeid(UserID), &quot;Copy To User: &quot;);
        &lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;

        if (!saveDialog.run())
        {
            return;
        }
        name = dialogField.value();

        &lt;span style=&quot;background-color: lightgrey;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------
        // applies to saveQueryToUser skf@28JAN2010
        // --------------------------------------------------------------&lt;/span&gt;
            dialogField_userid_value=dialogField_userid.value();
        &lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;
    }

    if (name)
    {
        sysQueryForm.parmPrintRanges(printRangeBox.value());
        sysQueryForm.parmPrintGrandTotal(printGrandTotalBox.value());
        sysQueryForm.parmPrintOnlyTotals(printOnlyTotalsBox.value());
        sysQueryForm.parmPrintRemoveRepeatedHeaders(printRepeatedHeadersBox.value());
        sysQueryForm.parmPrintRemoveRepeatedFooters(printRepeatedTotalsBox.value());

        sysQueryForm.queryBuild(range, sorting, companyRanges);
        sysQueryForm.querySave(name, validate);

        if (_updateDropDownBox)
        {
            sysQueryForm.buildSavedQueriesBox(savedQueriesBox);
            savedQueriesBox.selectText(name);
            this.queryLoad(name);
        }

        &lt;span style=&quot;background-color: lightgrey;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------
        // applies to saveQueryToUser skf@28JAN2010
        // --------------------------------------------------------------&lt;/span&gt;
        if (dialogField_userid_value &amp;amp;&amp;amp; dialogField_userid_value!=curUserID())
            this.saveQueryToUser(name, dialogField_userid_value);
        &lt;span style=&quot;color: green;&quot;&gt;// --------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;

    }
}

&lt;span style=&quot;color: green;&quot;&gt;//---[EOM: querySave ]-----------------------------------------------------------------------------&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;..</content><link rel='replies' type='application/atom+xml' href='http://axaptian.blogspot.com/feeds/3376392054766158678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://axaptian.blogspot.com/2010/01/savecopy-filtersqueriesinquires-to.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5494062667728592876/posts/default/3376392054766158678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5494062667728592876/posts/default/3376392054766158678'/><link rel='alternate' type='text/html' href='http://axaptian.blogspot.com/2010/01/savecopy-filtersqueriesinquires-to.html' title='Save/Copy the Filters/Queries/Inquiries to other users in AX'/><author><name>AXAPTIAN</name><uri>http://www.blogger.com/profile/09417321600735158979</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRm9ORB5oqZbmE3gjYQHk6TubK4WPFMpXH1ZjrqX_nt29imOXZ5l6vnVBDoE29A3M9ooIVrwcENdrR9kK5VexZLdCJjhngJ2DLRUKZ0jTa_hEukixtqb80uZeUVvqQcrUs23liriJ8JVAk/s72-c/Fig1-AX-Query-CopyToUser-SaveAs.png" height="72" width="72"/><thr:total>5</thr:total></entry></feed>