I use a macro whenever I call SET QUERY DESTINATION…

<!--Macro QueryDestination-->
<macro name="SetQueryDest">
<text>
SET QUERY DESTINATION(<caret/>;)
<selection/>
SET QUERY DESTINATION(Into current selection)

So if I write…
Query([Patient];[Patient]Dentist_Name="John Baughman")

Then realize I need to a query destination other than the current selection I 
highlight the above line of code and call the macro, I get…

SET QUERY DESTINATION(;)
QUERY([Patient];[Patient]Dentist_Name="John Baughman")
SET QUERY DESTINATION(Into current selection)

Cursor is now right after the first open parenthesis. Never miss putting it 
back to current selection.

Hope someone out there finds this useful.

John


> On Jun 21, 2019, at 6:30 AM, Charles Miller via 4D_Tech 
> <4d_tech@lists.4d.com> wrote
> :
> 
> Also I would bet crash wa due to undefined variable and not set query
> destination.
> 
> Regards
> 
> Chuck
> 
> On Fri, Jun 21, 2019 at 10:38 AM Douglas von Roeder via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> 
>> Chip:
>> 
>> When Set query limit and Set query destination came out, I ran into the
>> situation where queries “stopped working” because I had forgotten to add
>> the code to reset them. To avoid that, I made it a practice to type the
>> “reset” code *before* I type the code to change the destination or limit
>> from their normal settings.
>> 
>> --
>> Douglas von Roeder
>> 949-336-2902
>> 
>> 
>> On Fri, Jun 21, 2019 at 6:50 AM Chip Scheide via 4D_Tech <
>> 4d_tech@lists.4d.com> wrote:
>> 
>>> [Tl;DR] at end
>>> 
>>> This command is your friend - and - your foe!  :)
>>> 
>>> Yesterday I spent a significant amount of time trying to track down a
>>> compiled/built app crash, but did/does not happen interpretedly.
>>> 
>>> The crash happened only occasionally, after placing alerts and asserts,
>>> I determined that the crash was happening in a utility method which was
>>> doing a query. A method which, in the running code, had already been
>>> called repeatedly - without - issue.
>>> Since the method which was doing the query had been called repeatedly
>>> -before- the crash, I was perplexed as to what the issue was.
>>> After some more poking and prodding, it appeared that the crashing only
>>> occurred in the utility method, after a specific method (X) was called.
>>> Looking at X and watching it execute (interpretedly) provided no
>>> obvious clue as what the cause was.
>>> After staring at the code, and running both interpretedly and built
>>> many more times it finally dawned on me what the issue was...
>>> Set Query Destination
>>> 
>>> In method X I was doing some work looking for duplicate data, and in so
>>> doing I was loping over a code that looked like this:
>>> Set Query Destination(Into variable;$Local)
>>> <code>
>>> Set Query destination(Into current selection)
>>> <code>
>>> Set Query Destination(Into variable;$Local)
>>> 
>>> You might see the issue now...
>>> It turns out I never returned the query destination back to Current
>>> Selection.
>>> To make the problem even more challenging, the utility method where the
>>> query was crashing was in a component.
>>> 
>>> Interpretedly, 4D was happy to create and type the local any time a
>>> query was executed after query destination was left into a local
>>> variable.... but... Needless to say compiled/built 4D DID NOT LIKE
>>> THAT!  :)
>>> 
>>> [TL;DR]
>>> -- always -- reset your query destinations  :)
>>> Chip
>>> ---------------
>>> Gas is for washing parts
>>> Alcohol is for drinkin'
>>> Nitromethane is for racing
>>> **********************************************************************
>>> 4D Internet Users Group (4D iNUG)
>>> Archive:  http://lists.4d.com/archives.html
>>> Options: https://lists.4d.com/mailman/options/4d_tech
>>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>>> **********************************************************************
>> **********************************************************************
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **********************************************************************
> 
> -- 
> -----------------------------------------------------------------------------------------
> Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
> Informed Solutions, Inc.
> Brookline, MA 02446 USA Registered 4D Developer
>       Providers of 4D, Sybase & SQL Server connectivity
>          https://www.informed-solutions.com
> -----------------------------------------------------------------------------------------
> This message and any attached documents contain information which may be
> confidential, subject to privilege or exempt from disclosure under
> applicable law.  These materials are intended only for the use of the
> intended recipient. If you are not the intended recipient of this
> transmission, you are hereby notified that any distribution, disclosure,
> printing, copying, storage, modification or the taking of any action in
> reliance upon this transmission is strictly prohibited.  Delivery of this
> message to any person other than the intended recipient shall not
> compromise or waive such confidentiality, privilege or exemption from
> disclosure as to this communication.
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to