Peterh Posted May 22, 2003 Posted May 22, 2003 Hi, I have checked the numerous posts here on Portals, but unfortunately have not been able to work out a problem I have. SImple ordering system with 3 files: customer, item and line item. I display the items in the customer file through a portal. Clicking on an item then adds that item to the line item file linked to the customer record. All works well in FM. Am very close on the web, but not quite there. The following displays the portal rows correctly, but for some reason the pk_cust_id is only working on the first portal line. So if I click on the first portal line the record is added successfully, but not on any other portal line. [FMP-PORTAL: lr_item | g_constant] [FMP-FIELD: lr_item | g_constant::item_no] <A HREF="FMPro?-DB=lr_line_item.fmp&-Format=format.htm&-op=eq&item_no=[FMP-field:lr_item | g_constant::item_no] &fk_cust_id=[FMP-field:pk_cust_id]&-new">add record</A><BR> [/FMP-PORTAL] Any suggestions are very much appreciated (this has been driving me crazy for a while now!). Thanks, Peter.
Unable Posted May 23, 2003 Posted May 23, 2003 I'm not really sure, it may need FMP-CurrentPortalRowNumber. I'm intrigued by your use of a global. Since a web solution is a stateless solution, can this g_constant be changed? If so, what are the effects if several near-simultaneous requests are made on the global?
JitseSchaafsma Posted May 23, 2003 Posted May 23, 2003 I am not sure but how about the [Record] [/Record] tags that are missing. What is -Op=eq doing in a -New action? Jitse
Peterh Posted May 23, 2003 Author Posted May 23, 2003 Thanks for the feedback. FMP-CurrentPortalRowNumber doesn't seem to help at all. The global is part of the relationship between the customer file and the items file. In the items file there is a field called 'constant', which automatically populates with 1 when a new record is created. In the customer field there is a global field with 1 in it which creates the relationship. I have removed -Op=eq. Yep, not necessary. I tried [Record]... unsuccessfully. How should it be implemented in this situation? Should it be used with the Portal tags, or instead of the portal tags? Thanks, Peter.
Peterh Posted May 25, 2003 Author Posted May 25, 2003 Okay, worked it out. Ditched portals and used Inlines instead. The following works: <FORM ACTION="FMPRO" METHOD="POST"> <INPUT TYPE="hidden" NAME="-db" VALUE="lr_customer.fmp"> <INPUT TYPE="hidden" NAME="-lay" VALUE="cust_default"> <INPUT TYPE=hidden NAME="-token.1" VALUE="[FMP-CurrentToken:1]"> (token.1 was set on the previous page) [FMP-InlineAction: -db=lr_item.fmp, -lay=item_default, -token.1={CurrentToken:1}, constant="1", -find] [FMP-RECORD] <A HREF="FMPro?-db=lr_line_item.fmp&-format=format.htm&item_no=[FMP-field:item_no]&fk_cust_id=[FMP-CurrentToken:1]&-new">[FMP-FIELD: item_no]<BR></A> [/FMP-RECORD][/FMP-InlineAction] Cheers, Peter.
cinolas Posted May 28, 2003 Posted May 28, 2003 Hi all, I am having the exact same problem but unfortunately I cant just drop the portal... I beleive there is a way of solving this... and I am calling out for help! How can I make sure that a value from the current database passes on every form between my [portal] and [/portal] and not just the first one ? Any help is greatly appreciated ! Thanks
Garry Claridge Posted May 28, 2003 Posted May 28, 2003 To create new "related" records through a portal. You use "myportal::anyfield.0" in the Form or URL with "-edit". Just by creating the row, the link (related) field will have the key value inserted. Hope this helps. Garry
cinolas Posted May 28, 2003 Posted May 28, 2003 Can you clarify... For each portal row displayed on my page I have a form with a -new action that creates record in a different portal. A little more details: It's basically a report layout where there is a couple questions that are general to the report. There is also a portal containing reminders of other things that need to be reported on. For each reminders I display a form that will create a new record in the ReportLineItems DB. If I understand correctly you are saying that i could create a related record (that would inherit the ID necessary to the relation) by using an -edit tag instead and filling a dummy field with 0 ? What do you mean by "myportal::anyfield.0" ? What does the .0 part do ? Is "anyfield" a valid tag or you just mean any field will do ? Can you give me example code using this technique in a form submit ? Thanks a lot for the help !
Garry Claridge Posted May 28, 2003 Posted May 28, 2003 Are you trying to create new portal rows, or are you trying to create records in a third database? Garry
Garry Claridge Posted May 28, 2003 Posted May 28, 2003 Doing a search on .0" will also be worthwhile. All the best. Garry
cinolas Posted May 29, 2003 Posted May 29, 2003 The Report DB has two portals, one of all the Reminders and one of all the ReportLineItems. On my CDML page I have a [FMP-Portal:Reminders] tag that will place a form for every Reminders in the portal. However, each of those forms is meant to create a new record in the ReportLineItems DB and not in the Reminders portal. My problem now is that the ReportID (a field in the Report DB needed to create the relation with the new ReportLineItems record created by the forms) only results to the actual ReportID for the first form in the [portal] tag. Resulting in the form creating non-related records in the ReportLineItems DB. I'm pretty sure it would work if I could pass the ReportID to the Reminders DB and then use [FMP-Field:Reminders::ReportID] but the Reminders are not related to a specific Report so the relationship is impossible... Is there a special tag syntax to specify you want a field outside the portal ? I mean even within the [portal] tag I use [FMP-Field:Reminders::FieldName] so in theory, [FMP-Field:ReportID] should return the ReportID from the Report DB (outside the portal) ! I hope I am not being too confusing ! I did not understand what you meant by : >Doing a search on .0" will also be worthwhile. > >All the best. > >Garry Thanks for all the help !
Garry Claridge Posted May 29, 2003 Posted May 29, 2003 You could use a bit of Javascript to either pass the ID to each of your Forms. All the best. Garry
cinolas Posted May 30, 2003 Posted May 30, 2003 sounds like a good idea. But I know very little about Javascript.... can you suggest a way to do this ? I know that I can access the value returned for the ReportID from outside the [portal] tag, how can I (using javascript) store this value in a variable then access it from within the [portal] tag ? Your help is greatly appreciated.
cinolas Posted May 30, 2003 Posted May 30, 2003 I just understood the "Doing a search on .0" will also be worthwhile." and found out about multiple token ! And that is the solution ! I'll set some of my newly discovered multiple token to the ReportID (hopefully the Token will be accessible within the portal) and boum, problem solved. Thanks for all the help !
Garry Claridge Posted May 31, 2003 Posted May 31, 2003 Here is some Javascript to pass a value. [FMP-Record]<script>sTheValue = "[FMP-field:pk_cust_id]";</script> [FMP-Portal]<script> document.write('<A HREF="FMPro?-DB=lr_line_item.fmp&-Format=format.htm&-op=eq&item_no=[FMP-field:lr_item | g_constant::item_no]&fk_cust_id=' + sTheValue + '&-new">add record</A><BR>');</script> [/FMP-Portal] [/RMP-Record] All the best. Garry
Recommended Posts
This topic is 7916 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now