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

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

HMAC SHA256 in native 4D code?

2018-10-10 Thread Bill Hutten via 4D_Tech
As the subject says - is it possible to do this in native 4D (no plugin) in 
v17? 


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

Printing 4D Write to PDF via Windows 10 "Microsoft Print to PDF"

2019-03-01 Thread Bill Hutten via 4D_Tech
Hi all - Apologies in advance - if this has been discussed and I'm just missing 
it, please point me to the archives.

I need to print 4D Write docs (not 4D Write Pro), on Windows 10, to PDF, using 
the built-in "Microsoft Print to PDF" printer. This is the code I curently 
have, cobbled togeather from various sources:

SET CURRENT PRINTER("Microsoft Print to PDF")
SET PRINT OPTION(Spooler document name option;$fname)
SET PRINT OPTION(Destination option;2;$path)  
WR SET PRINT OPTION ($area;wr spooler document name option;$fname)
WR SET PRINT OPTION ($area;wr destination option;wr send to file;0;$path)
OPEN PRINTING JOB
WR PRINT ($area;0;1)
CLOSE PRINTING JOB

It works, in that a PDF is created, with the right $fname, at the right $path. 
It doesn't work, in that the PDF is 0 bytes in size.


Anyone have tested code that solves this problem?

- bill
**
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: Printing 4D Write to PDF via Windows 10 "Microsoft Print to PDF"

2019-03-01 Thread Bill Hutten via 4D_Tech
On Fri, Mar 1, 2019, at 1:16 PM, Koen Van Hooreweghe via 4D_Tech wrote:

> I think the OPEN/CLOSE PRINTING JOB is not needed and perhaps causing 
> problems with 4D Write.

Interestingly enough if those are removed the code does not print anything - no 
PDF file is created. They're used in a 4D TechNote example, but with 
PDFCreator, so I was not sure


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

Dealing with hetrogenous JSON list data

2020-01-28 Thread Bill Hutten via 4D_Tech
Hi all: Assume I have some JSON data that looks like this:

[
  {
"type": "foo",
"table": "bar"
  },
  "Sample String",
  1,
  2,
  3,
  "Sample String 2"
]

The "JSON Parse" works fine to parse that into a C_COLLECTION. However, at that 
stage, how do I deal with it? Specifically, how can I tell what type each of 
the elements in the collection are? Running under v17 so I can't use C_VARIANT.

Am I missing something obvious?


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

Write PICT to disk, 64bit

2020-02-13 Thread Bill Hutten via 4D_Tech
Hi all: We have some 4D Write Pro documents that contain PICT (and other 
format) images. This code will give us a list of all images from the document:

$res := WP Get Elements($area; wk_type_image)

We would like to be able to write these images to disk - but PICTURE TO BLOB 
and WRITE PICTURE FILE both require a relevant codec, which of course for PICT 
does not exist in 64bit 4D. Does anyone have any idea how we might solve this 
problem?


Thanks

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