Re: Do I want to use SELECTION TO ARRAY instead of GOTO SELECTED RECORD server-side in V17?

2018-09-16 Thread Bernd Fröhlich via 4D_Tech
David Adams:

> I'm checking for the simplest, least difficult default as that should work in 
> the vast majority of cases.


Here are my two Eurocents:
it does not matter how you collect the data, but concatenating the text in 
memory vs. writing to a file makes a HUGE difference when you have lots of 
records.

I have a method in my toolbox  that writes out a selection or a whole table 
into a file.
Looping through the records and appending each record to a file.
Works great.

Then I did the same but instead of writing to a file, I appended to a 
textvariable.
Works well for small amounts of data but is unusable for more than about 2 
records as it slows down ever more.
(I am lazy and did not do any pre-sizing, chunking, whatever.)

So if you want to export the data anyway and look for the simplest way, then 
just loop through the data and write into a file.

Greetings from Germany,
Bernd Fröhlich
**
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
**

Re: v17 Orda, Transactions, and ListBoxes with related many

2018-09-16 Thread Kirk Brooks via 4D_Tech
Hi Chris,

1) do table forms have any relevance in ORDA anymore?

Sure. Personally I am sticking with them for output forms in user mode, for
example. And I'm still including a bare bones input form as well. I
wouldn't use it for user-facing production forms.

I don’t want to mix ‘classic’ 4D in new projects, and so it seems that I
> should use project forms exclusively. What’s your take on that?
>
I haven't used MODIFY SELECTION in 10+ years. Forms I've made to allow
users to create selections have been dialogs with a listbox.

I am encapsulating my use of ORDA as I get familiar with it. What's that
mean? Within individual methods I don't mix them. As much as possible, and
so far it's been possible, I don't mix them in the context of an overall
task. So if I've got some update action to do which requires finding
records, evaluating and modifying them I'll do all that using ORDA or
classic.

There's a real temptation to use a classic QUERY 'cause I've been doing
that for a long time. But it's worthwhile to learn the ORDA commands for
doing the same thing.



> 2) Recording Editing with related MANY displayed in a ListBox.  ENTITY
> SELECTION-STYLE, not classic
> In a form, say, that displays an invoice, and the invoice detail is
> provided in a ListBox (Collection source), I am concerned about the
> situation where a user may delete lines from the Detail (ListBox) and then
> cancel the record edit (of the Invoice). It seems that editing the records
> (entities) displayed in the ListBox commits the changes as they take place.
>
Not unless you specifically call entity.save
().

The *entity.save( )* method saves the changes made to the entity in the
table related to its dataClass. You must call this method after creating or
modifying an entity if you want to save the changes made to it.


Does one control this through Transaction control (i.e. so that changes can
> be allowed, but not committed until OK’d)?
> If so, then how does one do that under ORDA, when one is using entity
> selections instead of ‘classic’?
>
The mechanics of this are what you are accustomed to.

ALL RECORDS
$selObj:=Create entity selection
START TRANSACTION
For each ($obj;$selObj) // read: for each $obj is $selObj...
If ($obj._ID%2=0)
$obj._ID:=$obj._ID-2
$obj.save()
End if
End for each
CANCEL TRANSACTION
In this instance each entity has _ID if it's even. Note the explicit save.
Since it's run in a transaction and the transaction is canceled the changes
aren't written to the datastore (records).

In the example you stated let's say you don't call .save() every time
there's a change - how do you do it? You want entity.touched()
.

The *entity.touched( )* method tests whether or not an entity attribute has
been modified since the entity was loaded into memory or saved.

If an attribute has been modified or calculated, the method returns true,
else it returns false. You can use this method to determine if you need to
save the entity.

ALL RECORDS
$selObj:=Create entity selection
START TRANSACTION

---  user stuff happens ---


For each ($obj;$selObj)
If ($obj.touched())
$obj.save()
End if
End for each

If($groovy)

VALIDATE TRANSACTION

Else
CANCEL TRANSACTION
End if



> When an INVOICE is to be edited:
>
> ds.Invoice.lock()
>
A pessimistic lock isn't necessary for the transaction to work using ORDA.
It's important in an existing database to avoid conflicts with 'classic'
processes because a pessimistic lock was the only type available before.

A note regarding user deletions of lines from a listbox. To be honest I
thought I understood how to do this but I just tested it and it's not
working. I filed a TAOW case on it asking for explanation so I'm going to
wait until I hear from them before saying anything about it.

Hope the rest helps.

-- 
Kirk Brooks
San Francisco, CA
===

*We go vote - they go home*
**
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
**

[MEETING] Montreal 4D Club Meeting

2018-09-16 Thread Thierry Daigneault via 4D_Tech
The next meeting of the Montreal 4D Club will be held Wednesday September 19th 
at 7 PM.

PLEASE NOTE: This month’s meeting is being held at a new address.


The schedule for the next meeting is as follows:
News
Questions
Presentations
- François Cloutier will talk about his latest work with 4Dwrite pro, 4DView 
pro and ORDA.
- Yves Barrette will demonstrate the power of preemptive processes
End of the meeting

We usually end up at some sort of restaurant after each meeting. Come and join 
us!



Address
---
Softconcept Canada
4378 Av Pierre-De Coubertin (coin Bennett)
Montréal



Anyone can attend. Please note that the meetings are usually held in French.

If you need more information, you can check out our web page at:
http://www.macapa.com/4dmtl 

You can also write to our communications officer:
Thierry Daigneault: tdaignea...@macapa.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
**

Re: v16 - playing videos stored in the database

2018-09-16 Thread webmaster namethatplant.net via 4D_Tech
Not sure if this would do what you want, but you might want to check out 
https://wimpyplayer.com/

Wimpy Player has the capability of playing both audio and video files on a web 
page. I presume that it would work on a Web Area as well (?).

In the HTML you pass a path to the file you want the viewer to be able to play, 
and the path can include 4D tags. In my case I'm using MP3 files. You can see 
it at work here:

http://www.namethatplant.net/plantdetail.shtml?plant=35

Janie Marlow
webmas...@namethatplant.net

--
> On September 15, 2018 at 4:21 PM Jody Bevan via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> 
> In years gone by, I used to provide this feature through an Escape plugin.
> 
> It seems to me that one should be able to do this through a WebArea. I am 
> obviously getting thick, but when I read the Web Area Language Reference I 
> seem to be missing a lot.
> 
> I thought it would be something simple like use a command like WAOpen URL and 
> pass in the field in the structure that contains the video. Since I didn’t 
> see that, the way we used to do it was to download the video locally, and 
> then load the pass in the file location from there. 
> 
> Am I on the right track, of missing the boat totally.
> 
> Some clues / pointers would be appreciated.
> 
> Thanks
> 
> Jody
> **
> 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
**

Re: Do I want to use SELECTION TO ARRAY instead of GOTO SELECTED RECORD server-side in V17?

2018-09-16 Thread David Adams via 4D_Tech
On Sun, Sep 16, 2018 at 9:09 PM Olivier Flury via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Not really an answer to your question but a more general observation:
>
> Very often, when I have to do an export function towards other systems, I
> end up in doing a bulk export.
>
> Either because I am lazy or the other side is lazy or both sides are lazy.
> It's easy, just send everything. But sometimes it is worth, doing more
> homework, on both sides, and export only what has changed since the last
> export. Sometimes this is simply not possible (too complex, the other side
> wants all data etc.), but very often it would be. And it would - most of
> the time - result in a drastic reduction of amount of data to exchange.
>

Well observed. In this case, I have the good fortune to be working with
source tables that include modification counters. (Think "sequence numbers"
on each change.) This makes it *incredibly* easy to find all records that
have been modified or added since the last push.

For deletion, records in 4D are marked with a deleted date. I've always
found this practice annoying and weird...and boy am I glad it's being used
in this. With the delete date field in place (soft deleted records), it's
simple to handle delete reconciliation. I don't push the delete date field,
just a Boolean based on it. So, you push everything up including the delete
flag, then a simple DELETE FROM table WHERE marked_for_deletion = true
takes care of it. Amazingly easy. Welsh Harris and Tim Nevels get all the
credit for setting things up this way in advance.

Even still, there are sometimes still millions of records to move,
particularly when we're first pushing a table over. In most cases, pushes
are quite manageable in size on a day-to-day basis. These tables are
getting pushed largely for aggregation and analysis, so it's not one-off
operations. Push and keep pushing as more data flows through 4D.
**
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
**

AW: Do I want to use SELECTION TO ARRAY instead of GOTO SELECTED RECORD server-side in V17?

2018-09-16 Thread Olivier Flury via 4D_Tech
Not really an answer to your question but a more general observation:

Very often, when I have to do an export function towards other systems, I end 
up in doing a bulk export.

Either because I am lazy or the other side is lazy or both sides are lazy. It's 
easy, just send everything. But sometimes it is worth, doing more homework, on 
both sides, and export only what has changed since the last export. Sometimes 
this is simply not possible (too complex, the other side wants all data etc.), 
but very often it would be. And it would - most of the time - result in a 
drastic reduction of amount of data to exchange.

|| https://flury-software.ch/

-Ursprüngliche Nachricht-
Von: 4D_Tech <4d_tech-boun...@lists.4d.com> Im Auftrag von David Adams via 
4D_Tech
Gesendet: Samstag, 15. September 2018 09:08
An: 4D iNug Technical <4d_tech@lists.4d.com>
Cc: David Adams 
Betreff: Do I want to use SELECTION TO ARRAY instead of GOTO SELECTED RECORD 
server-side in V17?

Short version:
I need to load some fields from records into a big text thingy.

[...]

**
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
**