Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Kirk Brooks via 4D_Tech
Hi Ben,


On Fri, Jul 7, 2017 at 5:15 PM, Ben Kershaw via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> When a method with this property checked is executed, it runs in the
> context of the servers “twin” process (which isn’t really a twin, since it
> doesn’t really share anything with the client process). If you want your
> OEC method called for an error in that method, you have to set that in the
> server processes context.
>
> Do you have some sort of generic “init process” method that you call
> whenever you start a new process? If so, create a new method with the
> “Execute on Server” attribute checked, and then call THAT method from your
> “init process” method; this will initialize the server processes context.
>
​Well I do now...
​


> I have a method called “InitServerProcess_sv” with the EoS property
> checked, and I call it from my InitProcess method. It sets up the OEC
> method and does a few other things. Has worked like a charm for years.
>

​That is a great idea. I just recently wrote a method to run like that when
I start processes to capture the process startup data Joaquin clued me into
last week. That is a good place to put such a call.

-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Alan Chan via 4D_Tech
We always install new On err call on triggers.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>I don't remember...triggers?

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

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread David Adams via 4D_Tech
Ben,

Thanks for these details, that's a huge help.

Does anyone know if this is documented anywhere? For that matter, are the
"twin" processes documented anywhere? I know that they were discussed at
some Summits in the past but, well, I haven't been to a Summit in over a
decade. Too. Darn. Far.

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

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Ben Kershaw via 4D_Tech
Kirk Brooks wrote:

>Yeah, so I'm talking about a method with the Execute on server attribute (or 
>property - whatever) checked.

When a method with this property checked is executed, it runs in the context of 
the servers “twin” process (which isn’t really a twin, since it doesn’t really 
share anything with the client process). If you want your OEC method called for 
an error in that method, you have to set that in the server processes context.

Do you have some sort of generic “init process” method that you call whenever 
you start a new process? If so, create a new method with the “Execute on 
Server” attribute checked, and then call THAT method from your “init process” 
method; this will initialize the server processes context.

I have a method called “InitServerProcess_sv” with the EoS property checked, 
and I call it from my InitProcess method. It sets up the OEC method and does a 
few other things. Has worked like a charm for years.

Keep in mind, though, that unless you pass something back in a parameter (or 
handle it some other way), the method running on the client doesn’t know that 
there was an error during execution on the server - the error method was called 
on the server, so anything that happened during your error handler happened on 
the server and doesn’t change anything on the client.

Regards,
Ben

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

Any issues with running v13.6 server and 13.5 clients?

2017-07-07 Thread Kirk Brooks via 4D_Tech
Just wondering.

Thanks

-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

Re: Request for tech note: Dave Terry's note on 2D Arrays

2017-07-07 Thread David Adams via 4D_Tech
Speaking of 2D arrays, a couple of things to note:

* APPEND TO ARRAY doesn't work when you're trying to append an array. You
need to insert an element at the end and then use COPY ARRAY. I'm not sure
that the 2D array commands have been updated since V2 apart from type
compatability, and APPEND TO ARRAY is a more recent command.

* I misinterpreted this part of the docs on SORT ARRAY:

Note:  You can sort the elements of a two-dimensional array (i.e.,
a2DArray{$vlThisElem}) but you cannot sort the two-dimensional array itself
(i.e., a2DArray).

I find myself thinking, "Bummer! I can't have a group of 1D and 2D arrays
and keep them together :(" Like a 1D array of item numbers and then 2D
arrays where you store how many of each item was ordered on the 1st, 2nd,
3rd, etc. Well, no, 4D works better than that. You can sort the 2D arrays
in the way you would hope, along with parallel 1D arrays. I just confirmed
this in a new database with some simple code:

ARRAY TEXT($check_1D_at;3)
ARRAY TEXT($check_2D_at;3;5)

$check_1D_at{1}:="Jan"
$check_1D_at{2}:="Feb"
$check_1D_at{3}:="Mar"

$check_2D_at{1}{1}:="1"
$check_2D_at{1}{2}:="1"
$check_2D_at{1}{3}:="1"
$check_2D_at{1}{4}:="1"
$check_2D_at{1}{5}:="1"

$check_2D_at{2}{1}:="2"
$check_2D_at{2}{2}:="2"
$check_2D_at{2}{3}:="2"
$check_2D_at{2}{4}:="2"
$check_2D_at{2}{5}:="2"

$check_2D_at{2}{1}:="3"
$check_2D_at{2}{2}:="3"
$check_2D_at{2}{3}:="3"
$check_2D_at{2}{4}:="3"
$check_2D_at{2}{5}:="3"

ALERT($check_1D_at{1}+" : "+$check_2D_at{1}{1})

SORT ARRAY($check_1D_at;$check_2D_at)

ALERT($check_1D_at{1}+" : "+$check_2D_at{1}{1})

On Sat, Jul 8, 2017 at 8:20 AM, David Adams  wrote:

> Thanks everyone! It's great having a community with a long history. So,
> not only did I get what I was looking for, I got more. Just to put things
> in perspective, I was after a tech note from *before the PDF format even
> existed.* Back in the days when that second MB of RAM was going to solve
> all of your problems
>
> Anyway, the note that I remembered is "Two-Dimensional Arrays" by Dave
> Terry, TN #92-14. This note is from 25 years ago and it remains the best
> documentation on the subject. I have no idea why it's never been folded
> into the main docs, it should be. Bart Davis said that he found it on one
> of the 4D FTP sites, so it's out there somewhere.
>
> Mike Goldsmith sent me a couple of articles that he wrote on cross-tabs
> some time back. Cross-tabs are great! They're also a sensible use of 2D
> arrays. I used to love the cross-tab editor in the original 4D Calc. (I
> think cross-tabs are often called 'pivot reports' or 'summarizing across'
> in other parts of the world.)
>
> Dennis Gallagher sent me something totally unexpected. I think that it is
> a V1 tech note, TN #92 from 1988 titled “Multi-Dimensional Arrays in 4th
> Dimension” by Djundi Karjadi & Joshua Wachs and later modified by Dave
> Terry & Ron Dell’Aquila. These guys were *emulating* 2D arrays using 1D
> arrays. I'm not worthy! I'm going to check it out as it's probably got some
> good ideas about packing.
>
> Thanks everyone!
>
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread David Adams via 4D_Tech
> And this is really my question - is this a bug or am I missing something?

Try it compiled and interpreted and see what you find - it might work
compiled. Either way, if the behavior is undefined it would be great to get
it sorted out. Error dialogs popping up on the 4D Server machine? Not good.
I guess you can file a case on-line as a US Partner, or there are the
forums in France? I think that you know the procedures better than I do.

Thanks for pointing this out, it's important! Please let us know what you
learn.

P.S. If someone actually knows or if it's in the docs and we've missed it,
please chime in.

P.P.S. Kirk, I guess if you can reproduce it in the latest R release, you
could report it as a bug in that release...
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Kirk Brooks via 4D_Tech
David,
I was hoping you might weigh in here.

Yeah, so I'm talking about a method with the Execute on server attribute
(or property - whatever) checked.

So the situation is a client process is churning away and passes some
arrays off to the EOS method for processing on the server (looking things
up, grinding away).

It's not running on the client (that's the point) but it's not entirely
native to the server either. I'm hearing the guy from the Princess Bride
here... "If he's not completely dead that means he's a little bit alive."

And this is really my question - is this a bug or am I missing something?

On Fri, Jul 7, 2017 at 3:43 PM, David Adams via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I'm not sure I'm following the basic setup because 'execute on server' can
> mean two things in 4D, can you clarify?
>
> If you're running a method with the 'execute on server' flag set then, huh.
> What a great question! I hope this is what you mean because, yeah, that's a
> nice detail. I don't know the answer and I won't be shocked to learn that
> this is a gap in the ON ERR CALL coverage in 4D. (4D seems to approach
> error handling as something tacked on top of things - there isn't a
> predictable or systemic scheme for it. At least it doesn't look like there
> is.) Does anyone know? I've got it on my list to do a deep dive on the
> Execute on server flag, but, well, I've got a long list.
> 
>

-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread David Adams via 4D_Tech
I'm not sure I'm following the basic setup because 'execute on server' can
mean two things in 4D, can you clarify?

Just to clarify my question...

$id:=Execute on server ("method name;etc)

If you're calling the Execute on server *command*, then you're spawning a
new process on 4D Server that runs there. No, it won't get the ON ERR CALL
you set up startup. The 'global' ON ERR CALL on 4D Server is for the
application process and..I don't remember...triggers? It used to depend on
compiled/interpreted and may depend on version. I don't remember off-hand
and would want to verify with your version anyway.

If you're running a method with the 'execute on server' flag set then, huh.
What a great question! I hope this is what you mean because, yeah, that's a
nice detail. I don't know the answer and I won't be shocked to learn that
this is a gap in the ON ERR CALL coverage in 4D. (4D seems to approach
error handling as something tacked on top of things - there isn't a
predictable or systemic scheme for it. At least it doesn't look like there
is.) Does anyone know? I've got it on my list to do a deep dive on the
Execute on server flag, but, well, I've got a long list.
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Request for tech note: Dave Terry's note on 2D Arrays

2017-07-07 Thread David Adams via 4D_Tech
Thanks everyone! It's great having a community with a long history. So, not
only did I get what I was looking for, I got more. Just to put things in
perspective, I was after a tech note from *before the PDF format even
existed.* Back in the days when that second MB of RAM was going to solve
all of your problems

Anyway, the note that I remembered is "Two-Dimensional Arrays" by Dave
Terry, TN #92-14. This note is from 25 years ago and it remains the best
documentation on the subject. I have no idea why it's never been folded
into the main docs, it should be. Bart Davis said that he found it on one
of the 4D FTP sites, so it's out there somewhere.

Mike Goldsmith sent me a couple of articles that he wrote on cross-tabs
some time back. Cross-tabs are great! They're also a sensible use of 2D
arrays. I used to love the cross-tab editor in the original 4D Calc. (I
think cross-tabs are often called 'pivot reports' or 'summarizing across'
in other parts of the world.)

Dennis Gallagher sent me something totally unexpected. I think that it is a
V1 tech note, TN #92 from 1988 titled “Multi-Dimensional Arrays in 4th
Dimension” by Djundi Karjadi & Joshua Wachs and later modified by Dave
Terry & Ron Dell’Aquila. These guys were *emulating* 2D arrays using 1D
arrays. I'm not worthy! I'm going to check it out as it's probably got some
good ideas about packing.

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

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Kirk Brooks via 4D_Tech
Jody,

Right, but what I'm seeing is a client side process which has an error
handler installed. Running a method with EOS an error is blocking the
server with the 4D native error handler. Even though the server has an
error handler installed. This is following the what's in the docs:

 "ON ERR CALL is usually placed in the startup database method of an
application, in order to handle errors for this application."

​Seems to suggest that would be the method called absent some specific
method and instead of the native 4D error handler. So that's why I expect
the server to use the handler I install there.

It seems like this is something specific to methods running EOS because
I've installed an error handler on both the server and the client process
but the 4D error handler is winding up with the call.


On Fri, Jul 7, 2017 at 2:52 PM, Jody Bevan via 4D_Tech <4d_tech@lists.4d.com
> wrote:

> On Error Call is process based. Therefore each process needs to call it.
>
>
-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

Re: What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Jody Bevan via 4D_Tech
On Error Call is process based. Therefore each process needs to call it.

Sincerely
Jody Bevan

> On Jul 7, 2017, at 16:45, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I think I know the answer to this but think I'll ask anyway.
> 
> When my server starts up in installs an error handler, ON ERR
> CALL("err_log_only"). As the name implies it simply logs errors and keeps
> churning.
> 
> It doesn't seem to be called when a method called by Execute on server is
> running. At least I'm occasionally seeing errors on the server from a
> couple of methods. The thing about this is the process calling these
> methods has its own error handler installed as well which is not being
> called.
> 
> So, is this a bug or is it the case that methods running as EOS have to
> explicitly call their own error handler? And if that's the case, as I think
> about it, is this a situation like the rest of process vars and the 'twin'
> process where it's the same but different. Ie, I can have process vars with
> the same names on both the client and server side but these vars can have
> totally different contents. Is it therefore the case with the Error
> handler? Installing a given handler on the client process doesn't affect
> the server side. If that's the case it sounds like I should be adding an
> EOS method to my process init to install a handler on the server twin.
> 
> Anyone else encountered this? What did you do?
> 
> -- 
> Kirk Brooks
> San Francisco, CA
> ===
> 
> *The only thing necessary for the triumph of evil is for good men to do
> nothing.*
> 
> *- Edmund Burke*
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://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: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

What exactly is the scope of the On err call between 4D server & Client?

2017-07-07 Thread Kirk Brooks via 4D_Tech
I think I know the answer to this but think I'll ask anyway.

When my server starts up in installs an error handler, ON ERR
CALL("err_log_only"). As the name implies it simply logs errors and keeps
churning.

It doesn't seem to be called when a method called by Execute on server is
running. At least I'm occasionally seeing errors on the server from a
couple of methods. The thing about this is the process calling these
methods has its own error handler installed as well which is not being
called.

So, is this a bug or is it the case that methods running as EOS have to
explicitly call their own error handler? And if that's the case, as I think
about it, is this a situation like the rest of process vars and the 'twin'
process where it's the same but different. Ie, I can have process vars with
the same names on both the client and server side but these vars can have
totally different contents. Is it therefore the case with the Error
handler? Installing a given handler on the client process doesn't affect
the server side. If that's the case it sounds like I should be adding an
EOS method to my process init to install a handler on the server twin.

Anyone else encountered this? What did you do?

-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

How to clear the Menu Bar

2017-07-07 Thread Jim Medlen via 4D_Tech

What is the best way to Clear or reset the menu bar to prevent
multiple menus ?

I do not see a Clear or Reset Menu Bar option.

I am getting multiple menus displayed when more than one
form is open with different Associated Menu Bars.

Case: The Form for Orders is open with Menu #3 and I open a
modal dialog for printing which has Menu #6 When I close the
modal dialog for printing I now have both Menu # 3 and Menu
# 6 displayed.



Thanks,

Jim Medlen
Computer & Information Systems
Functional Devices, Inc.
j.med...@functionaldevices.com
phone (765) 883-5538 x 428
fax (765) 883-4262
http://www.functionaldevices.com

This email was transmitted on 100 percent recycled electrons



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

Request for tech note: Dave Terry's note on 2D Arrays

2017-07-07 Thread David Adams via 4D_Tech
I'm working heavily with 2D arrays right now for the first time in ages,
and (re)discovered taht the docs are thin. Years (decades) ago Dave Terry
wrote a tech note called something like "2D Arrays' of around 4 pages. The
old notes aren't in the KB and I don't seem to have a copy of this one in
my own archives.

Does anyone have a copy? If I remember correctly, it covered the mechanics
really well.

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

Re: revelation! - Choose

2017-07-07 Thread Robert Livingston via 4D_Tech
Choose — Caution

IMO the documentation is slightly faulty in its example for the “integer” use 
of this command.
The issue is that Choose returns the “null” value for the type being used if 
the integer value is not in the range covered.


From the Documentation

****************
*****
Example 2  

Here is an example of the typical use of this command with a Number type 
criterion:
 vStatus:=Choose([Person]Status;"Single";"Married";"Widowed";"Divorced")
This code is strictly equivalent to:
 Case of
:([Person]Status=0)
   vStatus:="Single"
:([Person]Status=1)
   vStatus:="Married"
:([Person]Status=2)
   vStatus:="Widowed"
:([Person]Status=3)
   vStatus:="Divorced"
 End case
 ****************   
 ***
 
 This is not "strictly" correct. You need to add an Else to the Case statement 
to get complete equivalency
 The null value of the type (in this case "") is returned if the integer value 
is out of range (in this case the range is 0-3)
 
  Case of
:([Person]Status=0)
   vStatus:="Single"
:([Person]Status=1)
   vStatus:="Married"
:([Person]Status=2)
   vStatus:="Widowed"
:([Person]Status=3)
   vStatus:="Divorced"
Else
   vStatus:=""
 End case


So if vStatus had some other value going into the Choose statement, it is going 
to loose that value even if there was no matching criteria.


> On Jul 6, 2017, at 9:45 AM, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I found out about a command I had not known about
> Choose
> 
> I love this command
> if anyone does not know about it - read it is so nice to do in  one 
> line of code what other wee takes at least5

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