DNNDev.com Forums Minimize
How To - Relational Parent / Child Solutions
Last Post 07 Sep 2009 03:42 AM by ECF. 54 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 1 of 3123 > >>
Author Messages
Greg Brown
Advanced Member
Advanced Member
Posts:724
Avatar

--
02 Dec 2008 08:34 PM  
Attached is a tutorial on how to build relational parent / child solutions in Xmod. This is useful for when you have one-to-many type relationships such as an event management solution where one event could have many registrations. Or a CRM solution where one client could have many contacts, invoices, quotes, etc.

Hope this helps and if you have any questions post them here.

Greg

Attachment: 1122342424671.pdf

tomtom
New Member
New Member
Posts:37
Avatar

--
03 Dec 2008 02:51 PM  
Thank you very much! This will help a lot of people here.
Best
Tom


.at in .br
Darren
New Member
New Member
Posts:12
Avatar

--
03 Dec 2008 03:29 PM  
Very nicely presented tutorial -- thanks very much! This is sure to be a big help in my upcoming design.


Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
07 Dec 2008 07:34 PM  
Greg...

This was a BIG help! Makes some of the concepts and possibilities a lot clearer!



Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
08 Dec 2008 02:16 PM  
Thanks Greg

this is brilliant. I've nearly put together the system I wanted in just one day.

I have one problem though.

I can't work out how to pass the ID through as a parameter for the add form.

The following link does the intended part of adding an ID into the form field. This is in a text/html module as you suggest.

http://www.lightningprocess.com/Default.aspx?tabid=379&ctl=Edit&mid=1153&New=1&ID=101

However, I can't get the real ID into the URL. I'm not clear on that part.

Can you or anyone else enlighten me? Am sure it's simple.

Gus


if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Greg Brown
Advanced Member
Advanced Member
Posts:724
Avatar

--
08 Dec 2008 04:41 PM  
Hi Gus!

Ok, you got me and found a mistake! The text/html module won't work when you want to pass a parameter. You have to use Xmod because the text/html module won't read Xmod tags. To do this add another Xmod module to your view detail page. Configure the Xmod module to use the form that goes with the detail view you are displaying, the detail view you are using, and build a new "button" template for this module that has all the buttons you want to use. I usually add a back or return button first that will take the user back to the page with the grid/list view and sometimes some buttons to take them other places in the solution and then add new child records button(s). The url for the child record buttons should look something like this if you are using custom record id's as explained in tutorial:

<xmod:button text="Add Task" target="/MaintenanceAdmin/WorkManager/tabid/92/ctl/Edit/mid/438/New/1/assetID/<xmod:field name="ElecAssetID" />/
Default.aspx"></xmod:button>

Sorry for the mistake - I'll update the tutorial.

Greg


Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
09 Dec 2008 09:07 AM  
Hi Greg

thanks.
I'm still having real trouble here. I've done as you suggest but I'm finding that the ID I get from the master table is not the current record!

The master table is a list and when I click through I get the correct details and sub details. However, when I click the add new button I get the ID from the first row of the master table and not the current one.

Does this only work when you are displaying a single record on the master or is there some way of getting the current row?

Gus


if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
09 Dec 2008 09:53 AM  
Don't worry I figured it out.

The extra xmod module which contains the ADD button needed to be filtered based on the ID. I'd set the resultset size to 1 and hadn't noticed that I wasn't filtering out the records based on the URL param.

Now sorted.

Many thanks

Gus


if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
09 Dec 2008 10:13 AM  
arrghh!

no, that only worked because I was using the child forms record ID. But, when there are no child records there is no ID? I need the ID from either the details module or the current record from the master form.

Any ideas?


if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Greg Brown
Advanced Member
Advanced Member
Posts:724
Avatar

--
10 Dec 2008 07:43 PM  
Gus-

You are passing an id field (we'll say you called it assetid) from your parent record grid/list view to your details view page where you have the Detail View module, multiple Xmod modules for child grid/list views, and an Xmod module for your add new child records buttons. In the Xmod module for buttons select Configure Xmod module:

Required Settings:
Select the Form of your parent record
Select any detail view (you're not using it anyway)
Select the list view you built for add new buttons

Data Settings:
Filter Using URL parameters and select the field you passed to the page (assetid).

Display Settings:
Check the checkbox's "Hide Header" and "Hide Footer"

In your button list view you are going to have multiple "add new" buttons - one for each child form.

See if this helps. If you need addtional help set up a temporary admin account for me and I'll take a look.

Greg


Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
12 Dec 2008 08:20 AM  
thanks Greg

I've got it working now. It was just a simple error in the ID capture. Since the ID wasn't getting through the form defaulted to full data and current row.

all working now and thanks again
gus


if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
22 Jan 2009 08:42 PM  
Greg,

The EventID generated as you suggest {XMOD_UserId}{XMOD_Now:MMddyyyyhhmmss} get changed everytime the record is edited.

What am I missing? This breaks the relationship between the parent and the child.

Major big issue!


Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
23 Jan 2009 02:20 AM  
Switched using recordid exclusively...

Need to address this in the tutorial...a really big problem...


Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
23 Jan 2009 09:19 AM  
I've just tested this and am using Greg's method. But the ID as defined {XMOD_UserId}{XMOD_Now:MMddyyyyhhmmss} does not get updated on edit.

It's a read-only field and defaults to the above when empty but doesn't change unless you explicity edit it.

I did a lot of master record editing when I used the example and I didn't notice any child records missing afterwards.

Am I missing something?

gus


if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
23 Jan 2009 01:32 PM  
Gus,

How counter-intuitive is setting the field to read-only? Doesn't the term mean exactly what it says - read only...how would a generated value ever get written into the database - even on an add?

No verbiage in the tutorial indicates anything about a read-only field! If it works as you suggest (which I don't doubt), I have never seen XMOD documentation indicating such.

Thanks for the ping...but I have modified the coding to use the record id which I know works fine. I am concerned about the exclusivity of XMOD's record ID within the same database....both across multiple instances in the same portal and with multiple child portals...not completely clear on this...

XMP could not be more needed...I am a little frustrated coding around all the database issues with XMOD.

Roy



Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
23 Jan 2009 01:45 PM  
I'm not sure what the confusion is. This is a system generated ID field that's only purpose is to uniquely identify a record. I can't imagine why you would want to let the user edit it??

If it helps you could hide it from the user entirely, i.e. use a hidden field.

I will explore the use of xmod record ID but I think there might be some reason why record ID is not used.



if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
23 Jan 2009 01:58 PM  
Gus,
The user doesn't have access to it...it is hidden...just not marked as read only...which I would not think to do in 1000 years...since it has to have a value generated and written to the database.

No one is editing the field...but the DEFAULT value changes EVERYTIME you edit the record and the new value is written to database...breaking the relationship.

I certainly would not let the user edit a "key" field!



Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Angus Beare
Advanced Member
Advanced Member
Posts:761
Avatar

--
23 Jan 2009 05:51 PM  
Hmmm... that doesn't happen for me.

My field is visible on the form but read-only. The only time it changes is when the form loads for an ADD.

After that when I edit the record the ID is not updated.

Perhaps there's a difference with using a hidden field?

Gus

I see 'read-only' s not editable by the user. But that doesn't mean the program can't write to it.


if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
23 Jan 2009 07:26 PM  
Gus...

Read-only in EVERY programming environment with which I have been involved over the last 30 years...means READ ONLY.

The perception that I have always had with XMOD's read only approach was one form could write to it with a regular input field while you might call another form working against a subset of the same data on which parts of the data were only displayed.

IMHO, this is a major inconsistency...and one that needs to be documented/explained/expanded on/etc.

Glad that it works for you while marked as read only...but I view it as a flaw in the product design...sorry.



Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Tony Harrison
Advanced Member
Advanced Member
Posts:851
Avatar

--
23 Jan 2009 09:23 PM  
Hidden fields get updated during edits.
Use an Input tag with the style : Display=none


we don't make XMod, we make it better!
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
23 Jan 2009 09:32 PM  
That is even more inconsistent...but whatever...if that is the way it works...so be it. Interestingly, I normally use the style tag to hide things...for whatever reason I used the hidden tag...thinking there was no difference...

Thanks for the heads up!


Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
23 Jan 2009 09:34 PM  
question...

what is the downside of using XMOD recordid as the key?


Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Tony Harrison
Advanced Member
Advanced Member
Posts:851
Avatar

--
23 Jan 2009 11:50 PM  
[quote]Posted By rbarrow on 1/23/2009 4:34 PM

question...

what is the downside of using XMOD recordid as the key?[/quote]

Not sure there is one, it creates a unique id.
The only problem I can think of is if you wanted consecutive numbers, but as this is just an id field and doesn't need to be visible what the heck.



we don't make XMod, we make it better!
Roy Barrow
Basic Member
Basic Member
Posts:138
Avatar

--
26 Jan 2009 04:57 AM  
Thanks! That is what I thought...I just need a unique ID that will not change...that sounds like the ticket (and it is working just fine so far!).

Tnx again!


Never argue with an idiot...they will drag you down to their level...and beat you with experience!
Steven Berkowitz
New Member
New Member
Posts:10
Avatar

--
28 Jan 2009 04:57 PM  
Hi,
Quick question. What is the syntax of the xmod record id?
I have been trying to use:

<hidden ref="GrantID" width="100" maxlength="25">
<default>{XMOD_UserId}{XMOD_Now:MMDDyyyyhhmmss}</default>
</hidden>
But would rather use the unique id for the particular record. Month day year willl change upon update. Don't want that.

Any help would be greatly appreciated.


You are not authorized to post a reply.
Page 1 of 3123 > >>


Active Forums 4.1
spacer
dummy