Re: Many to Many Join Input Form

2016-10-14 Thread Chip Scheide
Using an Invoice, entry form, as an example.
This assumes all relations are Manual relations
(NOTE: all 'code' written in the email - not really code)

you would call a relation command in on load 
You would do this only if there is only 1 related table, or you want 
ALL related tables to load their data
:(Form event = on load)
  relate many([Invoice_Items]Invoice_id)
  
You can optionally use a query to get only those 'related' records for 
one related table
:(Form event = on load)
  query([invoice_items];[invoice_items]Invoice_ID=[invoice]Invoice_ID)

if you have 2 or more tables of related data you are displaying for the 
user
Invoice items
Shipping addresses
Payments received
When Invoices were sent

*I* would create a method to be called from the tab control** 
   invoice_Manage_Tab (longint : Tab 'page' being displayed)
In this method I would do the appropriate query to locate the needed 
'related' records based on which tab was being displayed (given the 
above related table list and order).
The Tab manager may do more then just locate records, depending on the 
way in which you are displaying the related records. It could load 
arrays if you are using an array based listbox, it could setup columns 
if you are using a selection based listbox, it could do calculations 
(sum of invoice items for example). THis would depend on the data being 
displayed and interface being used.
tab 1 - invoice items
tab 2 - Shipping addresses
etc

In the form method
:(form event = on load)
  invoice_Manage_Tab(1)  `loads invoice items for display
** - table control - allows user to switch between different related 
table views


Calculations (such as Invoice Item total)
this can be done in a few places - again depending on interface and 
what control the user has on what is displayed.
- In the tab manager, if the user can not change the display 
(add/remove/query)
- in the On Display Detail event (listbox, 4d view(?), (included) sub 
form)
- in the footer (listbox, 4D view(?), (included) sub form)

Note: I do not, have not used 4D view so I do not know what options are 
available.


Chip
On Thu, 13 Oct 2016 20:28:25 -0300, pk wrote:
> I am still understanding the manual relations (as chip mentioned), 
> and which events to use where for totals,
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-13 Thread pk

Keith C., Keith B, Chuck M, and Chip S.

Wow!

Thank you all so much for taking the time to walk me through some of the 
concepts of the join table and the UI interface Mechanics.


I made it through a rough working model with your advice, now, I will go 
back and do it all from scratch (a few times :) to make sure I really 
got it.


I am still understanding the manual relations (as chip mentioned), and 
which events to use where for totals, updating/modifying fields etc. The 
drag and drop UI is a new concept for me, I had no idea...neat.


All the best.

On 10/11/2016 04:09 PM, Kirk Brooks wrote:

Paul,
This is a problem that really is about the UI more than the mechanics of
how the data are connected. What makes it difficult is that the 'best' way
to look at it really depends on your point of view at the moment.


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-11 Thread Kirk Brooks
Paul,
This is a problem that really is about the UI more than the mechanics of
how the data are connected. What makes it difficult is that the 'best' way
to look at it really depends on your point of view at the moment. If you
are working in the company record you need to be able to select from the
other lists of names. If you are working on a person record, that is, the
person point of view, you want to be able to choose from a list of
companies.

The reason it's hard to get a nice, single input form is because you have
these two different points of view. My approach to these situations is two
separate windows (separate processes): one for the people and one for the
company.

If I'm working on a person record I can drag a company from the company
list to the person record. Add as many as you want. The same approach
applies to the companies - look up the correct person and drag them to the
company record.

If you don't like drag & drop you could work out some set of IP variables
to identify what's selected and work it that way. More complicated but if
that's the UI you prefer it certainly can be done.

Whatever mechanisms you employ to create the linkages in the data don't
really concern the users and they probably don't care what they are - they
just want them to work. I'd sketch out how you (or your users) want it to
look on the screen and how they want it to work. Then design the forms and
you can fit in the mechanics as necessary.

I use this approach for Items and Sales Orders, for example. It's the same
sort of issue - a given sales order can have any number of items on it and
a given item can be used in any number of sales orders. I've got an 'Item
Picker' that's a separate process with a floating window where any item can
be looked up and dragged to wherever it's needed. The Sales Order link back
to the items.

On Mon, Oct 10, 2016 at 8:43 AM, pk paul  wrote:

> ​...
>
> The join table is working properly, however, I am having a difficult time
> getting the Input forms to work properly, or, maybe a better way to put it,
> in a way that is more intuitive for an average user. It works, but, it does
> not "feel" good or coherent.
>
> So, the use cases are, for example.
>
> While in the company table, when you add an existing person to the
> company...or even a new person to the company and to the people table, what
> is a good way to make it all flow?


-- 
Kirk Brooks
San Francisco, CA
===
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-11 Thread Keith Culotta
This may help if I understand the question: 
https://www.dropbox.com/s/qwnnekzp4uzd1h1/ManyToMany.png?dl=0
I've used a link-table to store the attributes of the relationship between 
records in the two tables (eg, Position).  The Company entry form would look 
similar, with [Person]Name as column 2 of the listbox.  

Changes to column1 would need saving after each filed Data Change.

Keith 

> On Oct 11, 2016, at 11:50 AM, pk paul  wrote:
> 
> ​> The join table is working properly, however, I am having a difficult time
>> getting the Input forms to work properly, or, maybe a better way to put
> it,
>> in a way that is more intuitive for an average user. It works, but, it
> does
>> not "feel" good or coherent.
> 
> @Keith
> Hello Keith, thank you for the reply. Yes, I did, however, I do not see how
> they implemented the join or related record selection for use in the
> scenario I am mentioning, which is where I am having my difficulty. I am
> sure it is a common scenario, I am just missing something :)
> 
> @Chip
>> (simple) a button labeled 'People' which when clicked opens a new
>> window (process) showing a listing
> 
> Hello Chip, thank you for the reply and the outline/concept in general. I
> will experiment with that now, that has put me in the correct direction.
> 
> @Chuck
>> You will need to know if a person ca belong to more than one company.
>> How do you identify Charles Miller (me) if you have 3 in your db.
> 
> Hello Chuck, I think you are referring to there being 3 Charles Millers,
> all different people, but, same name?
> 
> If yes, then that means the list box or whatever I present to user, also
> includes additional identifing information, such as a location or some
> other unique type of detail?
> 
> If that is not what you meant, then I don't understand how you mean it.
> Because there should never be 3 idential records for one individual. right
> :)
> 
> @all
> due to the nature of a mailing list, maybe I should make a seperate post
> for this
> Other than asking on this list, are there other places to discover
> examples, in-depth discussion about things like this (best practices, pros,
> cons of particular solutions etc?​​)​​
> 
> Thank you to all that responded, I will spend some time on this and revert
> back. 

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-11 Thread Chip Scheide
in the form method
:(form event = on Load)

or if you have a tab control, in the code for managing the change of 
the tab page

you would put some code like this :
relate many([Parent_table]parent_Key)
or
Query([Child_table];[Child_table]Parent_key=[Parent_table]parent_Key)


see Relate Many command description in the language manual, or the 
online documentation, or the (html) help files (I use these, so I do 
not have a link to the online page). It gives a good description.

Relate Many is good if there is only *1* relation from the parent, 
however it triggers all relations and so can have side effects.

As a side note - I suggest that all your relations be set as MANUAL not 
as AUTOMATIC.
Automatic relations will do the relate many command for you - BUT - can 
have nasty side effects if you have circular relations as it will 
cascade through the relations.

ex: 
[Table A] -> [Table B] -> [Table C] -> [Table A]
 
with automatic relations, starting at [Table A],
related record from [Table B] will be located, and then related records 
from [Table C] will be located, 
after which (and this is where your problem comes in, [Table A] records 
will be loaded that are related to [TAble C].  THIS can change the 
current record(s) in [Table A].


On Tue, 11 Oct 2016 13:50:37 -0300, pk paul wrote:
> 
> @Keith
> Hello Keith, thank you for the reply. Yes, I did, however, I do not see how
> they implemented the join or related record selection for use in the
> scenario I am mentioning, which is where I am having my difficulty. I am
> sure it is a common scenario, I am just missing something :)
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-11 Thread pk paul
​> The join table is working properly, however, I am having a difficult time
> getting the Input forms to work properly, or, maybe a better way to put
it,
> in a way that is more intuitive for an average user. It works, but, it
does
> not "feel" good or coherent.

@Keith
Hello Keith, thank you for the reply. Yes, I did, however, I do not see how
they implemented the join or related record selection for use in the
scenario I am mentioning, which is where I am having my difficulty. I am
sure it is a common scenario, I am just missing something :)

@Chip
> (simple) a button labeled 'People' which when clicked opens a new
> window (process) showing a listing

Hello Chip, thank you for the reply and the outline/concept in general. I
will experiment with that now, that has put me in the correct direction.

@Chuck
> You will need to know if a person ca belong to more than one company.
> How do you identify Charles Miller (me) if you have 3 in your db.

Hello Chuck, I think you are referring to there being 3 Charles Millers,
all different people, but, same name?

If yes, then that means the list box or whatever I present to user, also
includes additional identifing information, such as a location or some
other unique type of detail?

If that is not what you meant, then I don't understand how you mean it.
Because there should never be 3 idential records for one individual. right
:)

@all
due to the nature of a mailing list, maybe I should make a seperate post
for this
Other than asking on this list, are there other places to discover
examples, in-depth discussion about things like this (best practices, pros,
cons of particular solutions etc?​​)​​

Thank you to all that responded, I will spend some time on this and revert
back.
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-10 Thread Chuck Miller
You will need to know if a person ca belong to more than one company. How do 
you identify Charles Miller (me) if you have 3 in your db.

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  



> On Oct 10, 2016, at 3:09 PM, Chip Scheide <4d_o...@pghrepository.org> wrote:
> 
> From a user perspective:
> 
> You are on a Company entry form, you have a list of personnel.
> You probably want the user to double click a blank line, or click a '+' 
> button to add a new person to the list.
> Here is an interesting issue: is the new person new to the system or 
> just the company?
> - new to the system
>  double click (or '+' button) opens the entry form FOR THE PERSON, not 
> the entry form for the m-2-m table.
>  The new person (record) will handle creating the linking record, 
> probably on SAVE (accept) of the new person record (form event = on 
> Validate, or in the trigger), assigning both the new person record ID 
> and the company ID.
> 
> - New person to the company - BUT - not new to the system.
>  You need to provide a means for the user to select the new person(s).
>  Maybe not the easiest way to do this for a beginning 4D developer, 
> but I prefer Drag N Drop.
>  (simple) a button labeled 'People' which when clicked opens a new 
> window (process) showing a listing
>  form for the [people] table, displaying the people already in the 
> system. 
>  The user can then select the person(s) and drag n drop them on the 
> person listing in the company entry form.
> 
> 
> For adding a company from the People entry form, just reverse the above.
> - New open the company entry form
> - add from existing - open a company listing window and drag n drop to 
> the person entry form.
> 
> You will likely need more details to implement this - but that is the 
> outline.

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-10 Thread Chip Scheide
From a user perspective:

You are on a Company entry form, you have a list of personnel.
You probably want the user to double click a blank line, or click a '+' 
button to add a new person to the list.
Here is an interesting issue: is the new person new to the system or 
just the company?
- new to the system
  double click (or '+' button) opens the entry form FOR THE PERSON, not 
the entry form for the m-2-m table.
  The new person (record) will handle creating the linking record, 
probably on SAVE (accept) of the new person record (form event = on 
Validate, or in the trigger), assigning both the new person record ID 
and the company ID.
 
- New person to the company - BUT - not new to the system.
  You need to provide a means for the user to select the new person(s).
  Maybe not the easiest way to do this for a beginning 4D developer, 
but I prefer Drag N Drop.
  (simple) a button labeled 'People' which when clicked opens a new 
window (process) showing a listing
  form for the [people] table, displaying the people already in the 
system. 
  The user can then select the person(s) and drag n drop them on the 
person listing in the company entry form.


For adding a company from the People entry form, just reverse the above.
- New open the company entry form
- add from existing - open a company listing window and drag n drop to 
the person entry form.

You will likely need more details to implement this - but that is the 
outline.

Chip

On Mon, 10 Oct 2016 12:43:31 -0300, pk paul wrote:
> Hello All, I am a newish 4d user with v15. I was subscribed to the basics
> list, but, i do not think it is active as there have been no messages. I
> hope it is ok to ask here, if not, please redirect me.
> 
> I am practicing with my first database and plan to use a many to many
> joining table between my "company" and "people" tables. I have persons that
> belongs to multiple companies, and, of course companies with multiple
> people.
> 
> Based on some of the discussion I just found in this list, I have made a
> joining table with the Primary key from each Table.
> 
> 
> The join table is working properly, however, I am having a difficult time
> getting the Input forms to work properly, or, maybe a better way to put it,
> in a way that is more intuitive for an average user. It works, but, it does
> not "feel" good or coherent.
> 
> So, the use cases are, for example.
> 
> While in the company table, when you add an existing person to the
> company...or even a new person to the company and to the people table, what
> is a good way to make it all flow?
> 
> And the similar scenario going from Person to company. I have an example of
> a person that has a day job and has just started 2 "companies" (so, 3 total
> companies for this one person) and each company has a different partner,
> the company has him plus another person. It seems I should be able to
> easily create the 2 new companies from the Person Table when clicking into
> the "company/join" subform.
> 
> Does anyone know of any examples I could see or study on how this is
> managed?
> 
> As I said, I can make it work, but, I would like a non user to feel
> comfortable doing this. What happens now is I double click on the output
> list subform and that goes to the input of the join table. Without knowing
> the ID of the person or companywhat to do?
> 
> Maybe a pop up list or search or?? how is this normally done?
> 
> I did search through the 4d support site for many to many, relations and
> join. I also looked in the design and language manuals, but, unless I
> missed it, again, not much in depth.
> 
> Where else to look? I hope I explained this in an understandable way.
> 
> Thank you in advance. pk
> 
> **by the way, is that at the correct place to view archives?
> http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
> I am kind of new to lists and I am having a bit of a hard time locating 4d
> related things for new users. As in more advanced topics than the
> tutorials, but, not as advanced as the discussions here:)
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Many to Many Join Input Form

2016-10-10 Thread Keith Culotta
Did you see this page?  
http://livedoc.4d.com/4D-Design-Reference-15-R5/Creating-a-database-structure/Types-of-relations.300-2964243.en.html

Keith - CDI

> On Oct 10, 2016, at 10:43 AM, pk paul  wrote:
> 
> Hello All, I am a newish 4d user with v15. I was subscribed to the basics
> list, but, i do not think it is active as there have been no messages. I
> hope it is ok to ask here, if not, please redirect me.
> 
> I am practicing with my first database and plan to use a many to many
> joining table between my "company" and "people" tables. I have persons that
> belongs to multiple companies, and, of course companies with multiple
> people.
> 
> Based on some of the discussion I just found in this list, I have made a
> joining table with the Primary key from each Table.
> 
> 
> The join table is working properly, however, I am having a difficult time
> getting the Input forms to work properly, or, maybe a better way to put it,
> in a way that is more intuitive for an average user. It works, but, it does
> not "feel" good or coherent.
> 
> So, the use cases are, for example.
> 
> While in the company table, when you add an existing person to the
> company...or even a new person to the company and to the people table, what
> is a good way to make it all flow?
> 
> And the similar scenario going from Person to company. I have an example of
> a person that has a day job and has just started 2 "companies" (so, 3 total
> companies for this one person) and each company has a different partner,
> the company has him plus another person. It seems I should be able to
> easily create the 2 new companies from the Person Table when clicking into
> the "company/join" subform.
> 
> Does anyone know of any examples I could see or study on how this is
> managed?
> 
> As I said, I can make it work, but, I would like a non user to feel
> comfortable doing this. What happens now is I double click on the output
> list subform and that goes to the input of the join table. Without knowing
> the ID of the person or companywhat to do?
> 
> Maybe a pop up list or search or?? how is this normally done?
> 
> I did search through the 4d support site for many to many, relations and
> join. I also looked in the design and language manuals, but, unless I
> missed it, again, not much in depth.
> 
> Where else to look? I hope I explained this in an understandable way.
> 
> Thank you in advance. pk
> 
> **by the way, is that at the correct place to view archives?
> http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
> I am kind of new to lists and I am having a bit of a hard time locating 4d
> related things for new users. As in more advanced topics than the
> tutorials, but, not as advanced as the discussions here:)
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**