Re: ORDA/Collections

2019-10-30 Thread Cannon Smith via 4D_Tech
Hi Justin,

Have you taken a look at the extract function on collections? I think it would 
do what you want.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Aetna, AB Canada




> On Oct 30, 2019, at 2:45 PM, Justin Will via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> $oRecs:=ds.Complex.query("Domain_ID = :1";_Domain_ID)
> $coll:=$oRecs.toCollection("ID, Name, Facilities.ID, Facilities.Name")
> $vtReturn:=JSON Stringify($coll)
> 

**
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: ORDA/Collections

2019-10-30 Thread Keisuke Miyako via 4D_Tech
"For each" loop is a good place to start.

once you've familiarised yourself with collections and objects,
you might want to look into collection methods such as map() for this kind of 
work.

2019/10/31 9:11、Justin Will 
mailto:jw...@willwerks.com>>のメール:
I couldn't seem to get Selection To JSON with a template to do what I wanted to.



**
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: ORDA/Collections

2019-10-30 Thread Justin Will via 4D_Tech
I couldn't seem to get Selection To JSON with a template to do what I wanted 
to.   I ended up writing this and it fits the bill.

For each ($oRec;$oRecs)
$oComplex:=New object
$oComplex.key:=$oRec.ID
$oComplex.label:=$oRec.Name
$oComplex.open:=True
ARRAY OBJECT($aoFacilities;0)
$oFacilities:=$oRecs.Facilities
For each ($oFac;$oFacilities)
C_OBJECT($oChild)
$oChild:=New object
$oChild.key:=$oFac.ID
$oChild.label:=$oFac.Name
APPEND TO ARRAY($aoFacilities;$oChild)
End for each 
OB SET ARRAY($oComplex;"children";$aoFacilities)
APPEND TO ARRAY($aoComplexs;$oComplex)
End for each 
$vtReturn:=JSON Stringify array($aoComplexs)

Thanks
Justin Will
**
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: ORDA/Collections

2019-10-30 Thread Keisuke Miyako via 4D_Tech
rather than using ORDA,
you could use classic QUERY and call Selection to JSON with a template.

https://doc.4d.com/4Dv15/4D/15.6/Selection-to-JSON.301-3817892.en.html

the feature allows you rename and reorder your selection of fields however way 
you like.

> 2019/10/31 5:45、Justin Will via 4D_Tech <4d_tech@lists.4d.com>のメール:
>
> $oRecs:=ds.Complex.query("Domain_ID = :1";_Domain_ID)
> $coll:=$oRecs.toCollection("ID, Name, Facilities.ID, Facilities.Name")
> $vtReturn:=JSON Stringify($coll)




**
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: ORDA/Collections

2019-10-30 Thread Kirk Brooks via 4D_Tech
Justin,
The replace string approach is not what you want to do. Editing strings and
mapping data are not the same thing. You also want to avoid hard coding
such maps. Any little change and you have to change code.

A fairly easy way to manage what you need to do is save an entity as a
stringified JSON. Open or paste this into your text editor.
Change the values for each field to the name you need to map it to. Don't
worry about data types or any of that.
Save this file in RESOURCES. Let's call it 'entityMap.json'

To use it:

$map_obj:=JSON Parse(Document to text())

$export_obj:=New object

For each($property;$entity_obj)

If($map[$property]=Null)  //  not mapped

$export_obj[$property]:=$entity_obj[$property]  //  use the existing name

Else

$export_obj[$map_obj[$property]]:=$entity_obj[$property]  //  use the name
you mapped it to

End if

End for each


//   do something with the export object


In this example I'm assuming the entity is a single 'level'. If you have
object fields you need to map as well you would put the testing part in a
method that takes a map and entity object as params. Then you could test
for object fields and pass the object recursively.

The code will work with any table because you have the actual map values
stored in JSON files.

Looking at the example you provided you are going to need to recognize when
you are exporting related entities. The basic idea is the same. I would
make handle each of the related entities a sub loop of the parent. It will
be more robust than including the relations in your parent entity map.

On Wed, Oct 30, 2019 at 1:45 PM Justin Will via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I need a json object output in a particular format and 4D's new datastore
> and collections do this out of the box in 3 lines of code for me.  It's
> almost magical.
>
> $oRecs:=ds.Complex.query("Domain_ID = :1";_Domain_ID)
> $coll:=$oRecs.toCollection("ID, Name, Facilities.ID, Facilities.Name")
> $vtReturn:=JSON Stringify($coll)
>
> The problem I have is the Javascript libraries I'm using that requires the
> data needs the names of the JSON elements to be named in a particular way.
> Is there a way to tell my collection rename ID to key and Name to label etc?
>
> So 4D is currently outputting this.
>
> [
> {
> "ID": 901,
> "Name": "MP",
> "Facilities": [
> {
> "ID": 1159,
> "Name": "MP:North"
> },
> {
> "ID": 1160,
> "Name": "MP:South"
> }
> ]
> }
> ]
>
>
>
> But what I need is this.
>
> [
> {
> "key": 901,
> "label": "MP",
> "children": [
> {
> "key": 1159,
> "label": "MP:North"
> },
> {
> " key ": 1160,
> "label": "MP:South"
> }
> ]
> }
> ]
>
> I know I could just do a replace in string but this feels like the wrong
> way to go at this.
>
> Thanks
> Justin Will
> **
> 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
> **



-- 
Kirk Brooks
San Francisco, CA
===

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**
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
**

ORDA/Collections

2019-10-30 Thread Justin Will via 4D_Tech
I need a json object output in a particular format and 4D's new datastore and 
collections do this out of the box in 3 lines of code for me.  It's almost 
magical.

$oRecs:=ds.Complex.query("Domain_ID = :1";_Domain_ID)
$coll:=$oRecs.toCollection("ID, Name, Facilities.ID, Facilities.Name")
$vtReturn:=JSON Stringify($coll)

The problem I have is the Javascript libraries I'm using that requires the data 
needs the names of the JSON elements to be named in a particular way.  Is there 
a way to tell my collection rename ID to key and Name to label etc?

So 4D is currently outputting this.

[
{
"ID": 901,
"Name": "MP",
"Facilities": [
{
"ID": 1159,
"Name": "MP:North"
},
{
"ID": 1160,
"Name": "MP:South"
}
]
}
]



But what I need is this.

[
{
"key": 901,
"label": "MP",
"children": [
{
"key": 1159,
"label": "MP:North"
},
{
" key ": 1160,
"label": "MP:South"
}
]
}
]

I know I could just do a replace in string but this feels like the wrong way to 
go at this.

Thanks
Justin Will
**
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
**

[solution] printing PDFs on windows from 4D

2019-10-30 Thread Chuck Miller via 4D_Tech
Hi All

There is a program named PDFtoPrinter.exe which I am using to print PDFs on 
windows from cmd using LEP form inside 4D

If the files desired do not print correctly, you will need to download PDF 
Exchange and print PDF form there. When it prints and is sized correctly, you 
will need to export the setting and place the file named PDF-XChange Viewer 
Settings.dat in the same folder you have placed PDFtoPrinter.exe. I found it at 
http://www.columbia.edu/~em36/pdftoprinter.html 


Please note that it is a wrapper for PDF exchange

Hope this helps someone else

Regards

Chuck

 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064   
 mailto:cjmillerinformed-solutions.com 
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D and Sybase connectivity
  http://www.informed-solutions.com  

This message and any attached documents contain information which may be 
confidential, subject to privilege or exempt from disclosure under applicable 
law.  These materials are intended only for the use of the intended recipient. 
If you are not the intended recipient of this transmission, you are hereby 
notified that any distribution, disclosure, printing, copying, storage, 
modification or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other than the 
intended recipient shall not compromise or waive such confidentiality, 
privilege or exemption from disclosure as to this communication. 

**
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: Deprecated constants

2019-10-30 Thread Timothy Penner via 4D_Tech
Hi David,

> For example, _o_Index compacting is not mentioned.

The "_o_Index compacting " constant was part of SET/GET DATABASE PARAMETER and 
it looks like it was already disabled in v11...

Here is a snippet from the v11 Language Reference page 168 showing it as 
"selector disabled":
https://imgur.com/a/HUxCWfY


-Tim




**
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: Components and external data

2019-10-30 Thread Tim Nevels via 4D_Tech
On Oct 30, 2019, at 2:00 PM, Chip Scheide wrote:

> Given the following situation:
> [Host_Database] <- [component] -> [external_for_Component]
> 
> - in the case of client/server how is the external database managed?
> -- would I place it in the component's resource folder?

You could if you wanted it to get sent to the client to be accessed locally by 
the client. But you would probably only consider doing this for a read only 
external database. Changes made to things in the Resources folder on 4D Client 
can get overwritten when new versions of the database are deployed.  

> -- is it automagically moved to the client via some other mechanism?
> -- or is the component's external database call passed back to the 
> server, call(s) made and then data transferred to client from server?

Check out the documentation for the USE DATABASE command. 

https://doc.4d.com/4Dv17/4D/17/USE-DATABASE.300-3786769.en.html

You use USE REMOTE DATABASE to access an external database managed by 4D 
Server. If you call USE REMOTE DATABASE from 4D Remote, it sends the request to 
4D Server and it does the work and sends back the data. But if you call USE 
REMOTE DATABASE from 4D Local it still works, it just accesses the external 
database at the specified path on the local machine. This is the 4D recommended 
way of doing it. 

And when you do it like this, 4D Server will manage multiple users accessing 
the external database for you. It will queue up requests and process them one 
at a time on 4D Server. And changes made to the external database are 
immediately available to all 4D Client users. 

You may need to use the "Execute On Server” property for some methods that are 
accessing the external database. Example: you want to auto create an empty 
external database if none exists at the specified path. Set the method that 
does that to “Execute on Server” so that the CREATE DATABASE DATAFILE will run 
on 4D Server. 

You can write it in such a way that there is very little difference between 
running 4D Local or 4D Remote/4D Server. “Execute on server” method property 
makes it easy.

I have a “Method History” component that I wrote that uses an external database 
to save snapshots of methods. I use it with 4D Local for all my development. I 
also use it on a project that uses 4D Team Developer with several developers 
using 4D Remote. Here is the code I put in On Startup and in On Server Startup 
database methods. Same code in both places:

  // configure Method History location and options
Case of 
: (Application type=4D Remote mode)
ISE METHOD HISTORY INIT REMOTE (Current user)

: (Is compiled mode)
  // Component not needed when compiled

Else   // 4D Local and not compiled
ISE SET METHOD HISTORY OPTION ("Version Format";"Date Time 
Version User Name")
ISE SET METHOD HISTORY OPTION ("User Name";Current user)
ISE SET METHOD HISTORY OPTION ("Version";Sys_GetVersion )
ISE SET METHOD HISTORY OPTION ("Storage Type";"External 
Database")
ISE SET METHOD HISTORY LOCATION (utl_Path_GetDirectoryPath 
(Structure file)+"Method History"+Folder separator)
End case 

It basically sets some IP variables that other methods in the component use.

ISE METHOD HISTORY INIT REMOTE actually calls another method that has “Execute 
on Server” property so that it can retrieve the value of some IP variables from 
4D Server.

ISE SET METHOD HISTORY LOCATION sets an IP variable to the path of the external 
database. It is in the same location on 4D Local or 4D Server — in a folder 
named “Method History” next to the structure file. And this method also called 
a method named “CreateExternalDatabase” that has Execute on Server set so that 
it runs on 4D Server when necessary. 

Tim

*
Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.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: Components and external data

2019-10-30 Thread Chip Scheide via 4D_Tech
Patrick,

THANKS!

Chip
On Wed, 30 Oct 2019 11:08:35 -0700 (MST), Patrick Emanuel via 4D_Tech 
wrote:
> 
> Hi,
> I understand that if a component needs to have access to 1 or more 
> tables there are 2 ways to do this:
> - Inject the table definition(s) into the host
> - USE DATABASE and connect to an external database/datafile.
> 
> I have some questions about using external databases in the context of 
> a component.
> 
> Given the following situation:
> [Host_Database] <- [component] -> [external_for_Component]
> 
> - in the case of client/server how is the external database managed?
>  -- would I place it in the component's resource folder?
>  -- is it automagically moved to the client via some other mechanism?
>  -- or is the component's external database call passed back to the 
> server, call(s) made and then data transferred to client from server?
>  -- something else
> 
> - As I read the 4D docs it seems that the external database can NOT 
> have/use a field of type C_Object as this is not supported by SQL, and 
> access is done to the external database only through SQL. 
>   -- Is this a correct interpretation?
> 
> - In a component with an external database, would I need to switch back 
> and forth between access to the external database and the host system?
> ex:
> method call from host includes pointer to table or field of host. To 
> satisfy the method call, data from the external database needs to be 
> accessed. I USE DATABASE(External) to the external database do query, 
> get data. 
> - do I need to place the retrieved external database data into 
> variable(s)?
> - do I need to then USE DATABASE(Host) before working with the host 
> table/field(s)?
> 
> Thanks for answering, and any other tips you may have regarding 
> external databases and components.
> 
> Chip
> We have done so much, with so little, for so long;
> We are now qualified to anything with nothing 
>   - unknown
> **
> 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
> **
> 
> 
> Hi Chip,
> 
> I use this mecanism every time in QS Toolbox and will speak about 
> this during the presentation planned next January.
> You really pointed out how to manage. Now, about C_OBJECT, I don't 
> save them. One trick could be to Jsonify it as text and perform the 
> reverse action when you need to get access to the information.
> 
> So, I manage action on server with the option 'Execute on server' as 
> method's property and for variable, I use GET/SET VARIABLE TO 
> VARIABLE commands.
> 
> Here is a SQL code on how to manage action executed on external 
> database and internal one:
> Begin SQL
>   USE REMOTE DATABASE DATAFILE :[$QS_VCS_COMP_DB_PATH] AUTO_CLOSE;
>   
>   SELECT count(*) 
>   from VCS
>   INTO :[$Count];
>   
>   USE DATABASE SQL_INTERNAL;
>   
> End SQL
> 
> You can ping me directly at: pat.emanuel67 @ gmail. com
> 
> Patrick
> 
> 
> _
> Sent from http://4d.1045681.n5.nabble.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
> **
We have done so much, with so little, for so long;
We are now qualified to anything with nothing 
  - unknown
**
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
**

Components and external data

2019-10-30 Thread Patrick Emanuel via 4D_Tech

Hi,
I understand that if a component needs to have access to 1 or more 
tables there are 2 ways to do this:
- Inject the table definition(s) into the host
- USE DATABASE and connect to an external database/datafile.

I have some questions about using external databases in the context of 
a component.

Given the following situation:
[Host_Database] <- [component] -> [external_for_Component]

- in the case of client/server how is the external database managed?
 -- would I place it in the component's resource folder?
 -- is it automagically moved to the client via some other mechanism?
 -- or is the component's external database call passed back to the 
server, call(s) made and then data transferred to client from server?
 -- something else

- As I read the 4D docs it seems that the external database can NOT 
have/use a field of type C_Object as this is not supported by SQL, and 
access is done to the external database only through SQL. 
  -- Is this a correct interpretation?

- In a component with an external database, would I need to switch back 
and forth between access to the external database and the host system?
ex:
method call from host includes pointer to table or field of host. To 
satisfy the method call, data from the external database needs to be 
accessed. I USE DATABASE(External) to the external database do query, 
get data. 
- do I need to place the retrieved external database data into 
variable(s)?
- do I need to then USE DATABASE(Host) before working with the host 
table/field(s)?

Thanks for answering, and any other tips you may have regarding 
external databases and components.

Chip
We have done so much, with so little, for so long;
We are now qualified to anything with nothing 
  - unknown
**
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
**


Hi Chip,

I use this mecanism every time in QS Toolbox and will speak about this during 
the presentation planned next January.
You really pointed out how to manage. Now, about C_OBJECT, I don't save them. 
One trick could be to Jsonify it as text and perform the reverse action when 
you need to get access to the information.

So, I manage action on server with the option 'Execute on server' as method's 
property and for variable, I use GET/SET VARIABLE TO VARIABLE commands.

Here is a SQL code on how to manage action executed on external database and 
internal one:
Begin SQL
USE REMOTE DATABASE DATAFILE :[$QS_VCS_COMP_DB_PATH] AUTO_CLOSE;

SELECT count(*) 
from VCS
INTO :[$Count];

USE DATABASE SQL_INTERNAL;

End SQL

You can ping me directly at: pat.emanuel67 @ gmail. com

Patrick


_
Sent from http://4d.1045681.n5.nabble.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: VP IMPORT DOCUMENT in v17R6

2019-10-30 Thread Jeremy Roussak via 4D_Tech
Chip,

Thanks, but using a POSIX path produces an error.

Jeremy

> On 30 Oct 2019, at 14:44, Chip Scheide <4d_o...@pghrepository.org> wrote:
> 
> Try using Posix - I know you should not have to
> follows a posix converter - 4D's (at least as of v15 is 
> incomplete/incorrect)
> 
> 
>  //fileutl_Path_Convert_to_Posix
>  // $1 - Text - Path to convert
>  //$2 - Pointer (Optional) - to Error Return Text
> 
>  //Original from JorgeChB via iNug
> 
>  //Converts a Mac file path to a Posix form
> 
>  //RETURNS - Text - converted path, or empty string if path is empty
>  // • Created 3/24/15 by Chip - 
>  //• Updated 05-17-18 by Chip - added test for empty path
> C_TEXT($Path;$Path;$0;$msg)
> C_POINTER($2;$Error_ptr)
> 
> errutl_Start 
> 
> If (Count parameters>=1)
> $Path:=$1
> 
> If (Count parameters>=2)
> $Error_ptr:=$2
> End if 
> 
> Case of 
> : ($Path="")
> $msg:="Source Path is empty"
> errutl_Add ($msg)
> 
> : (Position(Colon_Char;$Path)>0)
> 
> If ($Path#"")
> $Path:=Replace string($Path;Slash_Char;"__-sLaSh-__")  //'a/b' -> 
> 'a__-sLaSh-__b'
> $Path:=Replace string($Path;Colon_Char;Slash_Char)  //'a:b' -> 'a/b'
> $Path:=Replace string($Path;"__-sLaSh-__";Colon_Char)  
> //'a__-sLaSh-__b' -> 'a:b'
> $Path:=Replace 
> string($Path;BackSlash_Char;BackSlash_Char+BackSlash_Char)  //'a\\b' -> 
> 'a\\b'"
> $Path:=Replace string($Path;Space_Char;BackSlash_Char+Space_Char)  //'a 
> b' -> 'a\ b'
> $Path:=Replace string($Path;"*";BackSlash_Char+"*")  //'a*b' -> 'a\*b'
> $Path:=Replace string($Path;"'";BackSlash_Char+"'")  //'a'b' -> 'a\'b'
> $Path:=Replace string($Path;"&";BackSlash_Char+"&")  //'a' -> 'a\'
> $Path:=Replace string($Path;Quote_Char;BackSlash_Char+Quote_Char)  
> //'a"b' -> 'a\"b'
> $Path:=Replace string($Path;"(";BackSlash_Char+"(")  //'a(b' -> 'a\(b'
> $Path:=Replace string($Path;")";BackSlash_Char+")")  //'a)b' -> 'a\)b'
> $Path:=Replace string($Path;"|";BackSlash_Char+"|")  //'a|b' -> 'a\|b'
> 
>  //make sure we do not prepend 'Volumes' if it already there
> If (Position("/Volumes/";$Path)=0)
> $0:="/Volumes/"+$Path
> Else 
> $0:=$Path
> End if 
> Else 
> errutl_Add ("Source is empty.")
> End if 
> Else 
> $msg:="Posix conversion is only applicable "
> $msg:=$msg+"to paths formatted for use on a Macintosh."
> errutl_Add ($msg)
> End case 
> Else 
> $msg:="Required parameters (1) not passed."+Cr_Char
> $msg:=$msg+"Parameters passed "+String(Count parameters)
> errutl_Add ($msg)
> End if 
> 
> errutl_End (Current method name;$Error_ptr;Nil($Error_ptr))
>  //End fileutl_Path_Convert_to_Posix
> 
> 
> 
> NOTE: 
> - errutl_start initializes an error reporting system
> - calls to errutl_add builds a text message to return an error to 
> calling method
> - BOTH of the above can be removed or ignore or replaced with your own 
> error reporter
> 
> Chip
> 
> On Wed, 30 Oct 2019 11:30:29 +, Jeremy Roussak via 4D_Tech wrote:
>> I call VP IMPORT DOCUMENT(“vp”;Form.path) in the On VP Ready form 
>> event. Form.path contains a path in Mac system format, 
>> colon-delimited.
>> 
>> In v17R5, it works fine. In R6, on the same document, I get an empty 
>> spreadsheet. No error; just an empty sheet.
>> 
>> Mac, Mojave.
>> 
>> Any suggestions gratefully received.
>> 
>> Jeremy
>> **
>> 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
>> **
> We have done so much, with so little, for so long;
> We are now qualified to anything with nothing 
>  - unknown

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

Deprecated constants

2019-10-30 Thread David Rose via 4D_Tech
Is there a list of all deprecated constants, and how to replace them, in the 
knowledgebase or 4D Docs?
I'm referring to all constants that show up as "_o_ ..." in v17.

I don't think this page is complete:
https://doc.4d.com/4Dv17R6/4D/17-R6/Deprecated-or-removed-features-in-v17-product-range.200-4438814.en.html

For example, _o_Index compacting is not mentioned.

Thanks,
David

**
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: Write Pro Hide/clear pictures when printing

2019-10-30 Thread ADeeg via 4D_Tech
4D Tech mailing list wrote
> Hi,
> 
> We want to print a Write Pro document without printing the contained
> pictures
> Say we print to paper that has corporate identity, we don’t want to print
> the logo that is inside the Pro document
> So we want copy the pro document to a new one, and in this new document
> hide/clear the pictures (logo) and then print
> 
> When I set the picture to 0 bytes, the picture is not printed but I see an
> ugly black rectangle around it, so this does not work
> So, is there a way to procedurally hide/clear the pictures
> 
> Gr,
> Piotr

Try something like this as a timesaver


  // 
  // User name (OS): Armin Deeg
  // Date and time: 08.04.19, 14:34:23
  // 
  // Method: WP_ClearPictures
  // Description
  // Clears the pictures inside a WP document and replace them with a 
transparent png
  //
  // Parameters $1 = WParea, $0 = count of replaced pictures
  // 



C_OBJECT($obj;$WP_SourceObject;$1;$obj_section)
C_COLLECTION($collection)
C_LONGINT($i;$n;$posRange;$i_length;$vl_sectinLoop;$vl_Counter;$0)
C_PICTURE($pict)
C_TEXT($text;$vt_expression)
C_REAL($vr_pictSize)
$WP_SourceObject:=$1
READ PICTURE FILE(Tool_GetPath ("4dRes")+"Images"+Folder
separator+"Maske"+Folder separator+"Elemente"+Folder
separator+"transparent.png";$pict)
$collection:=WP Get elements($WP_SourceObject;wk type image inline)
$vl_Counter:=0

$i:=0
$n:=$collection.length
For ($i;0;$n-1)
$obj:=$collection[$i]

$vr_pictSize:=Picture size($obj.image)
If ($vr_pictSize>200)
$vl_Counter:=$vl_Counter+1
$r:=WP Text range($obj;1;2)
$oPicts:=WP Picture range($r)
WP_PictSettings ($oPicts;"Get")  //get width and height
WP INSERT PICTURE($oPicts;$pict;wk replace;wk include in range)
WP_PictSettings ($oPicts;"Set")  //set width and height
End if 
End for 

$collection:=WP Get elements($WP_SourceObject;wk type image anchored)
$i:=0
$n:=$collection.length

For ($i;0;$n-1)
$obj:=$collection[$i]
$vr_pictSize:=Picture size($obj.image)
If ($vr_pictSize>200)
$vl_Counter:=$vl_Counter+1
$text:=JSON Stringify($obj)
If (Position("imageExpression\":\"W";$text)>0)  // check if 
picture comes
from reference
WP_PictSettings ($obj;"Get")  //get width and height
  //WP GET ATTRIBUTES($obj;wk image 
expression;$vt_expression)
WP SET ATTRIBUTES($obj;wk image 
expression;"WP_EmptyPicture")  // method
returns a transparent png
WP_PictSettings ($obj;"Set")  //set width and height
Else 
WP_PictSettings ($obj;"Get")  //get width and height
WP SET ATTRIBUTES($obj;wk image;$pict)
WP_PictSettings ($obj;"Set")  //set width and height
End if 
End if 
End for 

$0:=$vl_Counter

#

  //WP_PictSettings

C_OBJECT($1;$obj)
C_TEXT($2;$what)
C_TEXT(wk_text1;wk_text2)
$obj:=$1
$what:=$2
If ($what="Get")
WP GET ATTRIBUTES($obj;wk width;wk_text1;wk height;wk_text2)
Else 
WP SET ATTRIBUTES($obj;wk width;wk_text1)
WP SET ATTRIBUTES($obj;wk height;wk_text2)
End if 

Regards Armin




--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: Write Pro Hide/clear pictures when printing

2019-10-30 Thread Bernd Fröhlich via 4D_Tech
Piotr Chabot Stadhouders:

> We want to print a Write Pro document without printing the contained pictures
> Say we print to paper that has corporate identity, we don’t want to print the 
> logo that is inside the Pro document
> So we want copy the pro document to a new one, and in this new document 
> hide/clear the pictures (logo) and then print


Same problem over here.
I clear the pictures with this code (V17R4):

$cPicts:=WP Get elements($oWriteProArea;wk type image)
For each ($oPic;$cPicts)
WP SELECT(oWriteProArea;$oPic)
INVOKE ACTION(ak clear)
End for each 

Unfortunately that works only if the WritePro area is in a layout.
Maybe in one of the next versions it will be possible to delete pictures in 
offscreen-areas.

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: VP IMPORT DOCUMENT in v17R6

2019-10-30 Thread Chip Scheide via 4D_Tech
Try using Posix - I know you should not have to
follows a posix converter - 4D's (at least as of v15 is 
incomplete/incorrect)


  //fileutl_Path_Convert_to_Posix
  // $1 - Text - Path to convert
  //$2 - Pointer (Optional) - to Error Return Text

  //Original from JorgeChB via iNug

  //Converts a Mac file path to a Posix form

  //RETURNS - Text - converted path, or empty string if path is empty
  // • Created 3/24/15 by Chip - 
  //• Updated 05-17-18 by Chip - added test for empty path
C_TEXT($Path;$Path;$0;$msg)
C_POINTER($2;$Error_ptr)

errutl_Start 

If (Count parameters>=1)
$Path:=$1

If (Count parameters>=2)
$Error_ptr:=$2
End if 

Case of 
: ($Path="")
$msg:="Source Path is empty"
errutl_Add ($msg)

: (Position(Colon_Char;$Path)>0)

If ($Path#"")
$Path:=Replace string($Path;Slash_Char;"__-sLaSh-__")  //'a/b' -> 
'a__-sLaSh-__b'
$Path:=Replace string($Path;Colon_Char;Slash_Char)  //'a:b' -> 'a/b'
$Path:=Replace string($Path;"__-sLaSh-__";Colon_Char)  
//'a__-sLaSh-__b' -> 'a:b'
$Path:=Replace 
string($Path;BackSlash_Char;BackSlash_Char+BackSlash_Char)  //'a\\b' -> 
'a\\b'"
$Path:=Replace string($Path;Space_Char;BackSlash_Char+Space_Char)  //'a 
b' -> 'a\ b'
$Path:=Replace string($Path;"*";BackSlash_Char+"*")  //'a*b' -> 'a\*b'
$Path:=Replace string($Path;"'";BackSlash_Char+"'")  //'a'b' -> 'a\'b'
$Path:=Replace string($Path;"&";BackSlash_Char+"&")  //'a' -> 'a\'
$Path:=Replace string($Path;Quote_Char;BackSlash_Char+Quote_Char)  
//'a"b' -> 'a\"b'
$Path:=Replace string($Path;"(";BackSlash_Char+"(")  //'a(b' -> 'a\(b'
$Path:=Replace string($Path;")";BackSlash_Char+")")  //'a)b' -> 'a\)b'
$Path:=Replace string($Path;"|";BackSlash_Char+"|")  //'a|b' -> 'a\|b'

  //make sure we do not prepend 'Volumes' if it already there
If (Position("/Volumes/";$Path)=0)
$0:="/Volumes/"+$Path
Else 
$0:=$Path
End if 
Else 
errutl_Add ("Source is empty.")
End if 
Else 
$msg:="Posix conversion is only applicable "
$msg:=$msg+"to paths formatted for use on a Macintosh."
errutl_Add ($msg)
End case 
Else 
$msg:="Required parameters (1) not passed."+Cr_Char
$msg:=$msg+"Parameters passed "+String(Count parameters)
errutl_Add ($msg)
End if 

errutl_End (Current method name;$Error_ptr;Nil($Error_ptr))
  //End fileutl_Path_Convert_to_Posix



NOTE: 
- errutl_start initializes an error reporting system
- calls to errutl_add builds a text message to return an error to 
calling method
- BOTH of the above can be removed or ignore or replaced with your own 
error reporter

Chip

On Wed, 30 Oct 2019 11:30:29 +, Jeremy Roussak via 4D_Tech wrote:
> I call VP IMPORT DOCUMENT(“vp”;Form.path) in the On VP Ready form 
> event. Form.path contains a path in Mac system format, 
> colon-delimited.
> 
> In v17R5, it works fine. In R6, on the same document, I get an empty 
> spreadsheet. No error; just an empty sheet.
> 
> Mac, Mojave.
> 
> Any suggestions gratefully received.
> 
> Jeremy
> **
> 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
> **
We have done so much, with so little, for so long;
We are now qualified to anything with nothing 
  - unknown
**
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: Write Pro Hide/clear pictures when printing

2019-10-30 Thread Tom Benedict via 4D_Tech
This just a wild guess, I haven’t tried it, but if you put a “white” (opaque) 
picture into the logo, does the black rectangle go away?

Tom Benedict

> On Oct 30, 2019, at 06:32, Piotr Chabot Stadhouders via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Hi,
> 
> We want to print a Write Pro document without printing the contained pictures
> Say we print to paper that has corporate identity, we don’t want to print the 
> logo that is inside the Pro document
> So we want copy the pro document to a new one, and in this new document 
> hide/clear the pictures (logo) and then print
> 
> When I set the picture to 0 bytes, the picture is not printed but I see an 
> ugly black rectangle around it, so this does not work
> So, is there a way to procedurally hide/clear the pictures
> 
> Gr,
> Piotr
**
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: VP IMPORT DOCUMENT in v17R6

2019-10-30 Thread Jeremy Roussak via 4D_Tech
Here’s a minuscule database and a version of the xlsx file, with useful data 
removed.

https://www.dropbox.com/s/ls7e695n046y63f/vp%20test.zip?dl=1 


Open “Form1” and run it. Choose “test.xlsx”.

Under R5, it loads. Under R6, it doesn’t. 

Am I missing something? How do I report a bug?

Jeremy

> On 30 Oct 2019, at 11:34, Jeremy Roussak via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Forgot to mention: the document is a simple xlsx Excel document, with four 
> sheets, 23k in size.
> 
> Jeremy
> 
>> On 30 Oct 2019, at 11:30, Jeremy Roussak via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>> 
>> I call VP IMPORT DOCUMENT(“vp”;Form.path) in the On VP Ready form event. 
>> Form.path contains a path in Mac system format, colon-delimited.
>> 
>> In v17R5, it works fine. In R6, on the same document, I get an empty 
>> spreadsheet. No error; just an empty sheet.
>> 
>> Mac, Mojave.
>> 
>> Any suggestions gratefully received.
>> 
>> Jeremy
**
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 Pro Hide/clear pictures when printing

2019-10-30 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi,

We want to print a Write Pro document without printing the contained pictures
Say we print to paper that has corporate identity, we don’t want to print the 
logo that is inside the Pro document
So we want copy the pro document to a new one, and in this new document 
hide/clear the pictures (logo) and then print

When I set the picture to 0 bytes, the picture is not printed but I see an ugly 
black rectangle around it, so this does not work
So, is there a way to procedurally hide/clear the pictures

Gr,
Piotr

**
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: Migrating to 4D Write Pro

2019-10-30 Thread ADeeg via 4D_Tech
Hi for converting old 4W/ or 4W6 write documents to Write Pro, there is a
technote

Link:
https://blog.4d.com/migrate-4d-write-documents-stored-in-picture-fields/

but you have to adjust the component to make it work in 64 bit.

See this forum post from me:

Link: https://forums.4d.com/Post/DE/31137137/1/31147868#31147868

Regards Armin


4D Tech mailing list wrote
> Actually, I *tried* to save my 4D Write letter -- both as a template and
> as
> a file. My "letters" originate in blobs, in a table called [LtrTemplate].
> From the input form of that record, I have the 4D Write area that displays
> the letter's content. I use the 4D Write menu to select File:Save (or
> File:Save As...) and instead of it actually doing this, I get an alert
> that
> says the file has not been saved. What gives?
> 
> Thanks!
> 
> On Tue, Oct 29, 2019 at 1:18 PM Tom Benedict 

> benedict.t@

>  wrote:
> 
>> Hi Doug,
>>
>> I’m pretty sure that the .4W7 format for 4D Write arrived long before
>> v15,
>> so you should be OK. You can confirm by creating a Write document on disk
>> and seeing what extension is assigned.
>>
>> You can also validate your conversions by having both a Write Classic and
>> a Write Pro area on a form so you can visually compare them. I found that
>> built my confidence in the conversion process. Or course, you’ll need to
>> be
>> using a 32bit version of 4D to do this.
>>
>> Another this to keep in mind that the blobs may be compressed, and, if
>> so,
>> will need to be uncompressed prior to conversion.
>>
>> Other than that, WP New makes conversion pretty easy.
>>
>> You may already be aware, though, that if you are doing any custom
>> configuration or formatting under program control in Write Classic, all
>> of
>> that will need to be re-written in Write Pro.
>>
>> HTH,
>>
>> Tom Benedict
>>





--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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: VP IMPORT DOCUMENT in v17R6

2019-10-30 Thread Jeremy Roussak via 4D_Tech
Forgot to mention: the document is a simple xlsx Excel document, with four 
sheets, 23k in size.

Jeremy

> On 30 Oct 2019, at 11:30, Jeremy Roussak via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I call VP IMPORT DOCUMENT(“vp”;Form.path) in the On VP Ready form event. 
> Form.path contains a path in Mac system format, colon-delimited.
> 
> In v17R5, it works fine. In R6, on the same document, I get an empty 
> spreadsheet. No error; just an empty sheet.
> 
> Mac, Mojave.
> 
> Any suggestions gratefully received.
> 
> Jeremy
> **
> 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
**

VP IMPORT DOCUMENT in v17R6

2019-10-30 Thread Jeremy Roussak via 4D_Tech
I call VP IMPORT DOCUMENT(“vp”;Form.path) in the On VP Ready form event. 
Form.path contains a path in Mac system format, colon-delimited.

In v17R5, it works fine. In R6, on the same document, I get an empty 
spreadsheet. No error; just an empty sheet.

Mac, Mojave.

Any suggestions gratefully received.

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

SV: OPEN DATA FILE gets endless loop

2019-10-30 Thread wangel--- via 4D_Tech
Hallo Chip,
Yes I am aware of that. I was experimenting with OPEN DATA FILE to avoid 4D 
asking for a datafile. My idea was to distribute at standalone program with the 
structure in one folder and the datafile in another folder. That way the 
datafile would not be deleted when updating the structure. But using Inno 
Script it appears to be possible to update the structure without deleting the 
datafile, even in a one folder scenario.
Thanks for your response.
Carl

>Date: Mon, 28 Oct 2019 16:35:27 -0400
>From: Chip Scheide <4d_o...@pghrepository.org>
>To: 4D iNug Technical <4d_tech@lists.4d.com>
>Cc: wan...@online.no
>Subject: Re: SV: OPEN DATA FILE gets endless loop
>Message-ID: <20191028163527822700.48a82...@pghrepository.org>
>Content-Type: text/plain; charset=iso-2022-jp

>Carl,
>Are you aware that once you point a 4D Database to a datafile - it remembers 
>that data file?
>So...
>Open database
> -> where is my data file
>Point database to data file
>-> OK I'm happy!
>startup completes.

>You never have to do this again, unless you want to change data files.

>Chip



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