RE: v13+ self referentail relations

2019-01-10 Thread Chip Scheide via 4D_Tech
this used to be possible.
what happens when an older structure with a self referential relation is 
upgraded?

>>  how do I draw a self-referential relation?
> You cannot make a single field both the primary and foreign keys of a 
> relation. You must choose two different fields.
> For example, you can make [Table_1]Field1 related to [Table_1]field2
> Reminder: the fields must be compatible with each other as you would 
> not be able to relate a longint field to an alpha field...

Hell is other people 
 Jean-Paul Sartre
**
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: v13+ self referentail relations

2019-01-10 Thread Timothy Penner via 4D_Tech
>  how do I draw a self-referential relation?
You cannot make a single field both the primary and foreign keys of a relation. 
You must choose two different fields.
For example, you can make [Table_1]Field1 related to [Table_1]field2
Reminder: the fields must be compatible with each other as you would not be 
able to relate a longint field to an alpha field...

>  how do I modify the system tables?
You cannot directly modify the system tables.
The system tables represent the underlying structure, so to change the system 
tables you would change the structure and then the system table will 
automatically reflect that change.

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

v13+ self referentail relations

2019-01-10 Thread Chip Scheide via 4D_Tech
How do you create a self referential relation?
in older versions you could drag the relational arrow back to the same 
field to get a 'loop'

This does not work now, and I tried to modify the system tables but 
these are locked, and I can not get them to unlock.

2 questions:
-  how do I draw a self referential relation?
-  how do I modify the system tables?

Thanks
Chip

---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
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: 4D Structure Export...

2019-01-10 Thread Tom Benedict via 4D_Tech
Hi Lutz,

Sorry to bug you again, but we’re moving forward on a project where we are 
consulting with a client who is setting up an agile development team to use 4D. 
They will be managing this team with Microsoft Team Foundation Server. I’m 
thinking that TFS should be able to serve as a repository for the 4D code 
(methods and forms) using the VC_Framework component that you have updated. 

> We have been doing something similar for some time with the VC_Framework 
> component. The original version of the component doesn't support the 
> re-import of code so we extended it with an import function for methods. The 
> procedure is a bit inconvenient, you have to do an additional step (the 
> import) manually after checking out the code from the versioning system 
> (Mercurial in our case) but it works flawlessly. We use this workflow and the 
> vc_framework component since 4d V13. Look here if you are interested: 
> https://github.com/elutz/vc-framework-v17 
> 
The part that isn’t completely clear to me is the Build/Release Management 
part. I’m trying to figure now is how to link code in the repository to TFS 
work items so that the release manifest that TFS produces includes all the 
methods and forms which are code complete and validated by QA. In your process, 
how do you know which methods to import?

Tom Benedict
**
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: Open a document in compiled: ok, but when with standalone get message: invalid path name

2019-01-10 Thread ernie hilgers via 4D_Tech
Solved…

Thank to all that gave me pointers & suggestions !!

> $tDocRef:=Open document($DocPath_t;”*";Read mode)
> 
> this is the point when I get the “file not found” error message. 
> 
> what am I missing….. ?

 the error was right after the “open document”  command
where I do a  "Document to blob”
I did NOT supply the document-path but only the document-name. :-(

In my “impatience” to quickly finish this program of a couple of lines, I was 
not reading the error message thorough enough. 
the cmd “open document” was on line 30
the cmd "Document to blob" was on line 32. 

all the time I assumed the error was referring to line 30.  

after doing what Timothy Penner suggested: split the program up into smaller 
parts (more or less)
the detail of the error messages caught my eye, that’s when I found my 
editorial error. 

thanks for all who gave me feedback !!

Greetings

ernie hilgers(aruba)
**
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: v13- Chasing Relations

2019-01-10 Thread Chip Scheide via 4D_Tech
Thanks!

on the first look it would appear to be simpler/faster to use Sql.

On Thu, 10 Jan 2019 21:15:48 +0100, Arnaud de Montard via 4D_Tech wrote:
> 
>> Le 10 janv. 2019 à 20:21, cjmiller--- via 4D_Tech 
>> <4d_tech@lists.4d.com> a écrit :
>> 
>> You could run it on server 
> 
> Running a method on server is great if there a lot of data to read 
> and/or write, because it avoids the transfer of these data through 
> network. Here the data is very small, time to ask server to run the 
> method and time to get that little data will be the same. Some times:
> - using SQL ~ 250 ms 1st time, then ~60 ms (I don't know why 1st time 
> is longer, BTW)
> - loop ~ 9 ms (and the server can do something better for other clients)
> 
> -- 
> Arnaud de Montard 
> 
> 
> 
> 
> 
> **
> 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
> **
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
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: v13- Chasing Relations

2019-01-10 Thread Arnaud de Montard via 4D_Tech

> Le 10 janv. 2019 à 20:21, cjmiller--- via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> You could run it on server 

Running a method on server is great if there a lot of data to read and/or 
write, because it avoids the transfer of these data through network. Here the 
data is very small, time to ask server to run the method and time to get that 
little data will be the same. Some times:
- using SQL ~ 250 ms 1st time, then ~60 ms (I don't know why 1st time is 
longer, BTW)
- loop ~ 9 ms (and the server can do something better for other clients)

-- 
Arnaud de Montard 





**
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: v13- Chasing Relations

2019-01-10 Thread cjmiller--- via 4D_Tech
You could run it on server 

Regards

 Chuck

Sent from my iPhone

> On Jan 10, 2019, at 2:10 PM, Arnaud de Montard via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> 
>> Le 10 janv. 2019 à 19:52, Charles Miller via 4D_Tech <4d_tech@lists.4d.com> 
>> a écrit :
>> 
>> You can use data form the following two 4d tables without having to
>> loop through each of your tables/fields [...]
> 
> Yes, but it's always slower in C/S (specially when it's far far away): using 
> system tables with SQL involves a request to the server, that ugly loop 
> doesn't. And if you compile it in a component it's reduced to nothing… 
> 
> -- 
> Arnaud de Montard 
> 
> 
> 
> 
> **
> 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: v13- Chasing Relations

2019-01-10 Thread Arnaud de Montard via 4D_Tech

> Le 10 janv. 2019 à 19:52, Charles Miller via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> You can use data form the following two 4d tables without having to
> loop through each of your tables/fields [...]

Yes, but it's always slower in C/S (specially when it's far far away): using 
system tables with SQL involves a request to the server, that ugly loop 
doesn't. And if you compile it in a component it's reduced to nothing… 

-- 
Arnaud de Montard 




**
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: v13- Chasing Relations

2019-01-10 Thread Charles Miller via 4D_Tech
You can use data form the following two 4d tables without having to
loop through each of your tables/fields

_USER_CONSTRAINTS

and

_USER_CONS_COLUMNS

. You can find these defined on page 57 or so iof the v_15 sql reference manual

Regards

CHUCK

On Thu, Jan 10, 2019 at 11:01 AM Arnaud de Montard via 4D_Tech
<4d_tech@lists.4d.com> wrote:
>
>
> > Le 8 janv. 2019 à 21:47, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> a 
> > écrit :
> >
> > given a pointer to a table, or a pointer to a field of a table,
> > I want to be able, for the current record of this table, to :
>
> Hi Chip,
> I use this for foreign keys:
>
> //DB_getForeignKeys (aTable_p)
> $parentTable_l:=Table($1)
> $FKarray_p:=$2
> CLEAR VARIABLE($FKarray_p->)
> For ($table_l;1;Get last table number)
> Case of
> : (Not(Is table number valid($table_l)))
> : ($table_l=$parentTable_l)
> Else
> For ($field_l;1;Get last field number($table_l))
> If (Is field number valid($table_l;$field_l))
> GET RELATION 
> PROPERTIES($table_l;$field_l;$destinationTable_l;$destinationField_l)
> If ($parentTable_l=$destinationTable_l)
> APPEND TO 
> ARRAY($FKarray_p->;Field($table_l;$field_l))
> End if
> End if
> End for
> End case
> End for
> $0:=Size of array($FKarray_p->)
>
> Primary is easier, just loop through fields of the start table and check if a 
> relation exists for the current one (as above).
>
> --
> Arnaud de Montard
>
>
>
> **
> 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
> **



-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Server 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: v13- Chasing Relations

2019-01-10 Thread Chip Scheide via 4D_Tech
Thanks Arnuad,
however, that will work, but requires a bunch of 'work'.

Thanks to Keisuke, again :), his query component contains code that 
pulls all relations ENDING (where the current field of parent table is 
the many of a one to many relation). without having to troll through 
the entire table structure.


So my final code looks like this:

For (all valid fields of parent table)
 query hidden structure definition tables for related many
 on current parent table field
  
  if (related many exist)
   clear selections on those tables
   RELATE MANY
   
   if (records in selection of any related many tables >0)
exit loop
$Dependancies_Exist := true
   end if
  else
   GET RELATION PROPERTIES (Current field)
   RELATE ONE

if Records in selection one table >0)
 exit loop
 $Dependancies_Exist := true
end if
  end if
end for
$0:= $Dependancies_Exist 


On Thu, 10 Jan 2019 17:02:52 +0100, Arnaud de Montard via 4D_Tech wrote:
> 
>> Le 8 janv. 2019 à 21:47, Chip Scheide via 4D_Tech 
>> <4d_tech@lists.4d.com> a écrit :
>> 
>> given a pointer to a table, or a pointer to a field of a table,
>> I want to be able, for the current record of this table, to :
> 
> Hi Chip, 
> I use this for foreign keys: 
> 
> //DB_getForeignKeys (aTable_p)
> $parentTable_l:=Table($1)
> $FKarray_p:=$2
> CLEAR VARIABLE($FKarray_p->)
> For ($table_l;1;Get last table number)
>   Case of
>   : (Not(Is table number valid($table_l)))
>   : ($table_l=$parentTable_l)
>   Else
>   For ($field_l;1;Get last field number($table_l))
>   If (Is field number valid($table_l;$field_l))
>   GET RELATION 
> PROPERTIES($table_l;$field_l;$destinationTable_l;$destinationField_l)
>   If ($parentTable_l=$destinationTable_l)
>   APPEND TO 
> ARRAY($FKarray_p->;Field($table_l;$field_l))
>   End if
>   End if
>   End for
>   End case
> End for
> $0:=Size of array($FKarray_p->)
> 
> Primary is easier, just loop through fields of the start table and 
> check if a relation exists for the current one (as above). 
> 
> -- 
> Arnaud de Montard 
> 
> 
> 
> **
> 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
> **
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
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
**

[TIP] Hiding rows of a collection based listbox (you can't and that's OK)

2019-01-10 Thread Kirk Brooks via 4D_Tech
In prior versions of 4D one of my favorite uses of array based listboxes is
for displaying lists of things and including a variable the user could type
into to filter the list as they typed. The technique involved two things:

the listbox had a 'hidden' array specified
the code for the search variable fired with the On After Edit form event

The code simply looped through the array being filtered and set the hidden
array depending on whether the string was found or not. It looks like this:

$search_str:=Get Edited Text+"@"

For($i;1;Size of array($nameArray))

aHidden{$i}:=$nameArray{$i}#$search_str

End for


I was updating a form that uses this trick to be a collection based
listbox. Collection based listboxes are so much more dynamic and flexible I
think it's worth the effort to convert them in most cases. But that's
another post. This post is about how to get the same effect since a
collection based listbox doesn't have the hidden array.

The first step was to identify what I was really trying to do. "I want to
hide some rows" I thought. Because that's what I did before. But really
what I want to do is filter the collection based on the search string.

Looking at it that way the first thought was, "well, I could just re-run
creating the collection." This can be too slow if the collection is built
from complicated conditions. And I wish I could use the query function
 for
collections but it returns a new collection. That doesn't help me because I
already have the collection displayed in my listbox. And it has to be fast
or the users will hate it because it slows down typing.

So why not just change the listbox to show the collection resulting from
the query? I typically avoid this sort of thing because in the past it
meant duplicating the initial set of arrays in memory. But objects are
references to the data. So having two instances of the same collection does
not double the memory used. To try this out I added a new instance of the
collection like this:

Form.dataCollection:=Method_to_get_data  //  get the complete list of data

Form.displayCollection:=Form.dataCollection // set the list to the display
collection

And changing the listbox I had already built was simple - I only had to
change the expression

in the properties list because all the references in the listbox itself
would still work because I wasn't changing the structure of the collection.
So far so good.

The code to accomplish the lookup turns out to be really simple:

Form.displayCollection:=Form.dataCollection.query("name = :1";Get Edited
Text+"@")

  // each element of the collection is an object. The object has a
property, "name", that is being queried.

 //  this is the equivalent of the example I began with


Really, that's it. Because my display collection is selected from the data
collection any changes the user makes on the listbox also 'flow' or
'update' or 'are reflected in' the data collection. That's important to
remember - because the collections are references, including the listbox
column assignment, a change to the root element (in this case
Form.dataCollection) propagates to all other instances. If I didn't want
this I could modify my collection query to make a new, separate collection.
This heads off into the differences and similarities of collections and
entity selections and saving data which is more than I want to get into
here.

I was updating a component that does stuff with method code (list the
methods, show the modified date, show the method attributes, etc.). Using
arrays I had to have an array for each data bit I wanted to display. With a
collection I create an object that has properties for each bit I want.
Takes about the same time to runs because the real work is getting the
code. But working with the collection is far easier. And the code to manage
all this on the form really shrank to about what you see above. There are
about 12 columns in the listbox. With arrays I had to identify each one
with a column and deal with all the array declarations. With a collection I
only need to declare it. The listbox columns set themselves to the correct
data type once I assign the data source.

To summarize - converting existing structures in 4D to utilize the new
language capabilities is as much about understanding what the actual task
is than about manipulating code. In this case the task is to display a
filtered list. The previous technique was to hide unwanted elements. The
new technique is to show the desired ones.

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

RE: Open a document in compiled: ok, but when with standalone get message: invalid path name

2019-01-10 Thread Tai Bui via 4D_Tech
Hi,

Something else to try is maybe running as Administrator. Perhaps it is a 
permissions issue.
Also where is the file located? Maybe you can try a simple new file on the 
desktop and call it with a simple hardcoded method to make sure it works in the 
first place to confirm it may have something to do with permissions.

Best Regards,
-Tai B.




**
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: v13- Chasing Relations

2019-01-10 Thread Arnaud de Montard via 4D_Tech

> Le 8 janv. 2019 à 21:47, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> given a pointer to a table, or a pointer to a field of a table,
> I want to be able, for the current record of this table, to :

Hi Chip, 
I use this for foreign keys: 

//DB_getForeignKeys (aTable_p)
$parentTable_l:=Table($1)
$FKarray_p:=$2
CLEAR VARIABLE($FKarray_p->)
For ($table_l;1;Get last table number)
Case of
: (Not(Is table number valid($table_l)))
: ($table_l=$parentTable_l)
Else
For ($field_l;1;Get last field number($table_l))
If (Is field number valid($table_l;$field_l))
GET RELATION 
PROPERTIES($table_l;$field_l;$destinationTable_l;$destinationField_l)
If ($parentTable_l=$destinationTable_l)
APPEND TO 
ARRAY($FKarray_p->;Field($table_l;$field_l))
End if
End if
End for
End case
End for
$0:=Size of array($FKarray_p->)

Primary is easier, just loop through fields of the start table and check if a 
relation exists for the current one (as above). 

-- 
Arnaud de Montard 



**
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: Open a document in compiled: ok, but when with standalone get message: invalid path name

2019-01-10 Thread Koen Van Hooreweghe via 4D_Tech
Hi Ernie,

Just a wild guess. Could you try without the "*"? Use an empty string or even 
remove the second parameter (it is optional).
$tDocRef:=Open document($DocPath_t;Read mode)

Are you building with the same desktop volume version?
Have you tried compiled against 4D developer (without building stand alone)

HTH
Koen

> Op 10 jan. 2019, om 16:35 heeft ernie hilgers via 4D_Tech 
> <4d_tech@lists.4d.com> het volgende geschreven:
> 
> $tDocRef:=Open document($DocPath_t;”*";Read mode)
> 
> this is the point when I get the “file not found” error message. 




Compass bvba
Koen Van Hooreweghe
Kloosterstraat 65
9910 Aalter
Belgium
tel +32 495 511.653

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

Open a document in compiled: ok, but when with standalone get message: invalid path name

2019-01-10 Thread ernie hilgers via 4D_Tech
Using 4D v15.6 on pc W7

Made a small program, no fields are used, no tables are used or present
all memory based and there is a “datafile” because 4D requires that. 

When running during interpreted and compiled, and open 1 particular file, using 
cmd “open document”
there is no error message and 4D “opens” the file, and every things works as 
designed.

But when I run that same program, as stand-alone, the file is NOT opened 
because of the following message: 
-The path name is invalid-   File not found  with error message#: -43  File not 
found.

The file path is obtained by doing a drag and drop on an area, 
the cmd: $DocPath_t:=Get file from pasteboard(1)  

some validation….

then I use:
$tDocRef:=Open document($DocPath_t;”*";Read mode)

this is the point when I get the “file not found” error message. 

wrote this little program in 2 hours but
I’ve spend 8 hours reading up on this single issue, changed to read-write etc. 
etc. 
But now I don’t know how to proceed. 

Can anyone have any pointers to why this is happening. 

path is the same in every situation, I put the path in a text variable to be 
displayed on screen
and there is no difference in the path, even after the error, the same path 
(info) is shown in the variable. 

what am I missing….. ?

greetings

ernie hilgers(aruba)

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