Re: "Record to Object" or "Selection to Object"?

2018-03-08 Thread Kirk Brooks via 4D_Tech
Bill,
Given that we now have a viable option for storing date/time values in a
single field (eg: string(date;ISO date;time)) why not just modify your
structure, create a new field and write both values to it. Even if you
decide to retain the discrete date & time fields this is not much overhead
and makes implementing anything with JSON a lot easier. Over time you may
eliminate the need for the old fields or not.

Personally I never used date/time fields for scheduling preferring a DTS
(date time string) field instead. This is essentially the ISO string
without the markup. I find the searching and sorting on a single field much
easier and it made transitions like this very east too.

As cool as a lot of the new 4D features are, and I do think they are both
cool and tremendously useful, a lot of those advantages can be lost
attempting to hammer old structures into a shape that allows you to use
them. A little judicious refactoring and structure changes can yield a lot
of benefit.

On Thu, Mar 8, 2018 at 8:09 AM, Bill Hutten via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> On Thu, Mar 8, 2018, at 11:17 AM, Keisuke Miyako via 4D_Tech wrote:
>
> > OB Copy with pointers is effectively the "record to object" feature.
>
> Ahh - that's useful. Now if only 4D supported pointers to methods. :)
>
> Here's the specific issue: I have a record (many, actually heh) that has
> this sort of structure:
>   [Appts]Title
>   [Appts]Start_Date
>   [Appts]Start_Time
>
> I want to produce this sort of object:
>   { title: "foo", start: '2018-02-12T08:30:00Z' }
>
> Using "OB Copy"I can create a "template" object that will convert the
> pointer->[Appts]Title into the "title" attribute in the copied object. So
> far so good. But what's a clean method to convert the date & time fields in
> the record into a single field in the object?
>
> What I'm doing right now is manually processing the generated object via
> code that does OB SET and OB REMOVE. Not ideal, but it works. Obviously
> method pointers would be a perfect solution, but in the unfortunate absence
> of perfection is there another solution that I'm missing?
>
>
>
> Thanks for your help.
>
> - bill
> **
> 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
> **
>



-- 
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: "Record to Object" or "Selection to Object"?

2018-03-08 Thread Bill Hutten via 4D_Tech
On Thu, Mar 8, 2018, at 11:17 AM, Keisuke Miyako via 4D_Tech wrote:

> OB Copy with pointers is effectively the "record to object" feature.

Ahh - that's useful. Now if only 4D supported pointers to methods. :)

Here's the specific issue: I have a record (many, actually heh) that has this 
sort of structure:
  [Appts]Title
  [Appts]Start_Date
  [Appts]Start_Time

I want to produce this sort of object:
  { title: "foo", start: '2018-02-12T08:30:00Z' }

Using "OB Copy"I can create a "template" object that will convert the 
pointer->[Appts]Title into the "title" attribute in the copied object. So far 
so good. But what's a clean method to convert the date & time fields in the 
record into a single field in the object? 

What I'm doing right now is manually processing the generated object via code 
that does OB SET and OB REMOVE. Not ideal, but it works. Obviously method 
pointers would be a perfect solution, but in the unfortunate absence of 
perfection is there another solution that I'm missing?



Thanks for your help.

- bill
**
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: "Record to Object" or "Selection to Object"?

2018-03-08 Thread Keisuke Miyako via 4D_Tech
it's not often the case that you'd need all the fields represented in the 
object.
on top of that, sometimes the structure defined field names or even their order 
of appearance may not be ideal.
OB Copy with pointers is effectively the "record to object" feature.

http://doc.4d.com/4Dv15/4D/15.5/OB-Copy.301-3576906.en.html

for a selection, you could call APPEND TO ARRAY and OB Copy inside APPLY TO 
SELECTION.

like you say, the JSON commands are not the right tool for this kind of task 
because there is no need to produce text.

2018/03/08 23:41、Bill Hutten via 4D_Tech 
<4d_tech@lists.4d.com> のメール:

Yeah - I'm currently doing: "Selection to JSON" and then "JSON PARSE ARRAY" but 
that's kindadumb. Also there's no "Record to JSON" or "Record to Object", 
so when I want to do that I've got to do a ONE RECORD SELECT which is also a 
hassle... hm.



**
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: "Record to Object" or "Selection to Object"?

2018-03-08 Thread Milan Adamov via 4D_Tech


> On Mar 8, 2018, at 15:41, Bill Hutten via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
>> On Thu, Mar 8, 2018, at 10:31 AM, Christian Sakowski via 4D_Tech wrote:
>> 
>> have you looked at "Selection to JSON" and "JSON TO SELECTION"? But it 
>> will not cover all field types.
> 
> Yeah - I'm currently doing: "Selection to JSON" and then "JSON PARSE ARRAY" 
> but that's kindadumb. Also there's no "Record to JSON" or "Record to 
> Object", so when I want to do that I've got to do a ONE RECORD SELECT which 
> is also a hassle... hm.
> 
> 

I am using Cannon’s Object code library for this.

Milan

**
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: "Record to Object" or "Selection to Object"?

2018-03-08 Thread Bill Hutten via 4D_Tech
On Thu, Mar 8, 2018, at 10:31 AM, Christian Sakowski via 4D_Tech wrote:

> have you looked at "Selection to JSON" and "JSON TO SELECTION"? But it 
> will not cover all field types.

Yeah - I'm currently doing: "Selection to JSON" and then "JSON PARSE ARRAY" but 
that's kindadumb. Also there's no "Record to JSON" or "Record to Object", 
so when I want to do that I've got to do a ONE RECORD SELECT which is also a 
hassle... hm.


- bill
**
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: "Record to Object" or "Selection to Object"?

2018-03-08 Thread Christian Sakowski via 4D_Tech
Hi,

have you looked at "Selection to JSON" and "JSON TO SELECTION"? But it will not 
cover all field types.
--

Grüße/Regards,
[heubach-media] | Christian Sakowski
christian.sakow...@heubach-media.de
iChat/AIM: SakowskiF
Tel: +49/(0)40/52 10 59-23



> Am 08.03.2018 um 15:27 schrieb Bill Hutten via 4D_Tech <4d_tech@lists.4d.com>:
> 
> I admit I've not been keeping 100% up to date with the many language changes 
> in 4D v16 - so before I go write a bunch of test code (or worse, read the 
> documentation) - do current versions of 4D have commands to convert from a 
> record to an object, or selection to object array, and ideally vice-versa as 
> well? Or do I still have to write these?
> 
> 
> Thanks, apologies for the "please do my homework" question, etc.
> 
> 
> - bill
> **
> 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
> **


--
heubach media
Osterfeldstr. 12-14 | Haus 1 | Eingang Nord
22529 Hamburg
tel: 040 / 52 10 59 - 10 | fax: -99
mail: i...@heubach-media.de
home: www.heubach-media.de
Geschäftsführer|CEO: Matthias Heubach

Mieten Sie Ihre Computer, iPads & Drucker für Ihre Events bei:
http://www.milo-rental.com

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten 
haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht 
gestattet.
 
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.
**
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
**

"Record to Object" or "Selection to Object"?

2018-03-08 Thread Bill Hutten via 4D_Tech
I admit I've not been keeping 100% up to date with the many language changes in 
4D v16 - so before I go write a bunch of test code (or worse, read the 
documentation) - do current versions of 4D have commands to convert from a 
record to an object, or selection to object array, and ideally vice-versa as 
well? Or do I still have to write these?


Thanks, apologies for the "please do my homework" question, etc.


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