0
votes

I have 3 forms (A,B,C) in my database. I am using LocNumber as the unique key to bind them together (although I could of course use UNID).

I want to present the user(s) with one Xpage that has these three forms. I have made a CC for A,B, and C and bound them to the correct form in the datasource.

My save button does a validate and then saves datasources.

But how do I "bind" the three cc's together on the page? In form B I have a LocNumber field. Do I create a field in cc B for LocNumber bind it to LocNumber on the form but load it with the value from UNID on form 1?

This must be a solved problem.

BTW, I choose to chunk everything like this as I will have a separate group of people to edit each set of fields (in form A,B,C).

1
Though this doesn't answer your question directly: when using multiple datasources (no matter where you define them) keep in mind to set the "ignore request params" attribute of the page itself to "true". Otherwise your datasources are treated as "one" and not as separate ones.Oliver Busse
Ah right. I did that and I am no longer getting rep/save conflicts. When I save the Xpage, the the second form gets saved, but I just don't yet know how to bind it to the first. My key is LocNumber, and I have that surfaced in the second cc but how do I load it with the loc from the first datasource?Bryan Schmiedeler
You just reference the values to read (for storing into the second datasource) by the first datasource's name and item like dsTwo.getDocument().replaceItemValue("itemName", dsOne.getDocument().getItemValue("itemName") This one gives an overview: xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/…Oliver Busse
My datasources, however, don't "know" about each other. I could move them up to the Xpage level but it seems that each CC should have one datasource and one form. What do you think?Bryan Schmiedeler

1 Answers

2
votes

I also prefer to use a uniqueKey like @Unique() for instance. Though in XPages you need to wrap it in a session.evaluate() to get the old school style.

Anyway - first you might want to rethink this. there isn't a need to chunk this up between 3 forms/documents. You could do it all with one and put each chunk into a Panel and compute the read only property so it's true for people that don't have editor access and false for people that do. That works really well.

for the custom controls. I would pass in the key as a custom property. Then inside each use that to compute to the document so it's available to you. SSJS to getdocumentbykey type of thing.