Re: Multi-Table Query Into JSON?

2018-03-24 Thread Keisuke Miyako via 4D_Tech
Hello,

"Movable form dialog box" is not the same as "Movable dialog box", even if the 
constant values are both 5.
Open window and Open form window do not simply differ in the parameter list,
the former is based on an old API which is why it is recommend to not use it 
anymore.

"Movable form dialog box" has close and maximise buttons,
unlike "Movable dialog box" or ALERT.

2018/03/24 3:13、Keith Culotta via 4D_Tech 
<4d_tech@lists.4d.com> のメール:
The "Movable form dialog box" type became available for "Open form window" at 
some point.  It is also constant 5.
A "Plain form window" with Cancel in the Deactivate event is user friendly, but 
will probably appear behind a floating window.



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

Re: Multi-Table Query Into JSON?

2018-03-23 Thread Keith Culotta via 4D_Tech
The "Movable form dialog box" type became available for "Open form window" at 
some point.  It is also constant 5.  

A "Plain form window" with Cancel in the Deactivate event is user friendly, but 
will probably appear behind a floating window.

Keith - CDI

> On Mar 23, 2018, at 12:15 PM, Keisuke Miyako via 4D_Tech 
> <4d_tech@lists.4d.com > wrote:
> 
> as far as the window type is concerned, ALERT is like any DIALOG,
> you can pass the constant Movable dialog box to Open window to get similar 
> effect.
> 
> http://doc.4d.com/4Dv16/4D/16.3/Window-Types-compatibility.300-3651740.en.html
>  
> 
> 
> note that this kind of window is not available for Open form window.
> 
> http://doc.4d.com/4Dv16/4D/16.3/Window-Types.300-3651761.en.html 
> 



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

Re: Multi-Table Query Into JSON?

2018-03-23 Thread Keisuke Miyako via 4D_Tech
as far as the window type is concerned, ALERT is like any DIALOG,
you can pass the constant Movable dialog box to Open window to get similar 
effect.

http://doc.4d.com/4Dv16/4D/16.3/Window-Types-compatibility.300-3651740.en.html

note that this kind of window is not available for Open form window.

http://doc.4d.com/4Dv16/4D/16.3/Window-Types.300-3651761.en.html

---

an app should really try to use the appropriate window type the way they are 
intended.

basically, a window should be one of 3 classes; document, dialog or tool.

a list form or a detail form or form that displays some settings is actually a 
"document".
put another way, if a forms has a "save" button, it must be a document.

modal windows should only be reserved for "dialogs",
where the app stops and waits for the user to give directions.

only a "tool" that accompanies a "document" should use a palette or toolbar 
window.

(floating is different to modal,
in that it never become the key window that accepts keyboard input.
it is allowed to have a focusable text input but ideally it should mainly 
consist of clickable widgets)

an app can have many UX problems such as the infamous "window order flipped" 
icon,
or a modal window being displayed behind another modal window,
when it uses a window type intended for dialogs or tools to display documents.

what is special about ALERT, in my opinion,
is that it is a UI command yet thread safe.

http://doc.4d.com/4Dv16/4D/16.3/ALERT.301-3651314.en.html

this is intentional, but again, because it is a developer tool.



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

Re: Multi-Table Query Into JSON?

2018-03-23 Thread Kirk Brooks via 4D_Tech
On Thu, Mar 22, 2018 at 10:48 PM, Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> it’s not that the command has negative attributes, it’s more to do with
> the fact that the command is too basic. a similar example is ALERT. I know
> many applications use it in production, and there is nothing wrong about
> that, but fir me, it is primarily a development tool for quick testing, I
> would never use it in production.
>

​Not to be argumentative but there are places where ALERT is desirable or
difficult to duplicate. For example, in my custom alert method I found that
if I try to open a window with a modal or floating window already in the
foreground my new window would open behind it. The only way I've been able
to handle that situation is with ALERT or using the currently open window.

​I'd be glad to know about a better way to handle that - it's been a while
since I messed with that code.

-- 
Kirk Brooks
San Francisco, CA
===

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

Re: Multi-Table Query Into JSON?

2018-03-23 Thread Keisuke Miyako via 4D_Tech
just as a reminder:

the preferred option to configure automatic relations in code is to use SET 
FIELD RELATION.

http://doc.4d.com/4Dv15/4D/15.5/GET-FIELD-RELATION.301-3577374.en.html

the scope is the current process and you have better control over which 
relations to automate.

2018/03/23 12:54、Kelderic via 4D_Tech 
<4d_tech@lists.4d.com> のメール:
I ended up having to call Set Automation Relations(True;True) at the beginning 
of the method.



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

Re: Multi-Table Query Into JSON?

2018-03-23 Thread Kelderic via 4D_Tech
I ended up writing a wrapper method called SelectionToJSON (named to match
our existing naming convention), which is called like this:

SelectionToJSON("Table";"[Table]Field1;[Table]Field2;[RelatedTable]Field1")

Inside the method, it breaks apart the second parameter and builds a
template object. If the field is not part of the main method, it prepends
"TableName_" to the JSON key.

It does rely on having the automatic relations set up in the structure,
which I had to play around with to get working. I ended up having to call
Set Automation Relations(True;True) at the beginning of the method.

As to whether Selection to JSON should be used in production, it seems to me
like it's meant to be used because it's a LOT faster than looping through
arrays and building JSON strings manually, which is what we used to do. I've
cut 30 second response times down to 10, for very large lists.



--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Multi-Table Query Into JSON?

2018-03-22 Thread Keisuke Miyako via 4D_Tech
it’s not that the command has negative attributes, it’s more to do with the 
fact that the command is too basic. a similar example is ALERT. I know many 
applications use it in production, and there is nothing wrong about that, but 
fir me, it is primarily a development tool for quick testing, I would never use 
it in production.

Selection to JSON is not optimised for client server. there is a round trip for 
every record, unless you use it with the execute on server method property.

it does not support pagination. if you use in an export tool, you will not be 
able to cancel it or display progress, which is not ideal in production.

and as the original post pointed out, it does not support related tables. maybe 
you can embed it in a process 4D tags template in a way that the returned JSON 
becomes a sub object; just make sure the commas are printed at the right place.

I have worked with several customers who were having difficulties developing 
some new JSON features. they were trying to do it with Selection to JSON, and 
the solution in each case was to not insist on using that command.



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

Re: Multi-Table Query Into JSON?

2018-03-22 Thread Tim Nevels via 4D_Tech
On Mar 22, 2018, at 8:23 PM, Keisuke Miyako wrote:

> Selection to json is a very simple command with very specific usages.
> 
> it is nothing like selection to array.
> 
> put another way, it is not an important command, you don’t need to know it, 
> there is nothing you can’t do without it.
> 
> it is like a convenience command for quick testing when you want to stringify
> a selection.
> 
> in production, if you need to produce json from a selection, you should never 
> be using this command.

Why do you say this? Why is this command “bad” to use in a production 
environment? The documentation makes no reference to any restrictions on using 
this command.

As far as I’m concerned all 4D commands are just fine to use in “production” 
except for the TRACE and ABORT commands. 

Tim

*
Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.com
*

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

Re: Multi-Table Query Into JSON?

2018-03-22 Thread Keisuke Miyako via 4D_Tech
it’s when you call it on a “template” object whose property values are pointers 
to fields.



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

Re: Multi-Table Query Into JSON?

2018-03-22 Thread Keisuke Miyako via 4D_Tech
Selection to json is a very simple command with very specific usages.

 it is nothing like selection to array.

put another way, it is not an important command, you don’t need to know it, 
there is nothing you can’t do without it.

it is like a convenience command for quick testing when you want to stringify
a selection.

in production, if you need to produce json from a selection, you should never 
be using this command.

if you are interested in getting an object array, you should not go through 
json, you should procedurally use OB commands (OB copy in template mode). you 
can combine it with apply to selection and the execute on server method 
property.







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

Re: Multi-Table Query Into JSON?

2018-03-22 Thread Douglas von Roeder via 4D_Tech
Kelderic:

You're welcome.

The examples in the docs illustrate how the command can be used but, as
we've seen, they're *not* exhaustive. In this case, the functionality works
in V15 but never made it to the docs.

Over the years (decades) 4D has created it's own little "circle of life"
thing with developers.

4D add commands to the language and provides examples.

4D developers use those commands + examples until the command breaks and
then we complain about it.

4D responds "Why would you want to do that?" and tells us to file a bug
report.

4D reads the bug report, updates the ticket as "Can't reproduce", and
clicks the "Resolved" button. :-)



--
Douglas von Roeder
949-336-2902

On Thu, Mar 22, 2018 at 11:13 AM, Kelderic via 4D_Tech <4d_tech@lists.4d.com
> wrote:

> We are currently running on v15, not v16. The documentation for Selection
> to
> JSON for v15 doesn't have example two. I'll try running it and see if it
> works, or at least use this as a reason to push for updating 4D. Thanks,
> mate.
>
>
>
> --
> Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> 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)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**