As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
What I have is an inventory form where the user can select check boxes for items and proceed to check them out. I've written a subroutine that works just as it is supposed to, but only when there are no records on the table. When I run it again while there are records in the data source I receive FocError -22. As far as I know there is no official list of the FocErrors(which I would like to see) but from what I can gather it indicates that I'm encountering a unique identifier issue. But I know from using the Type command that the IDs trying to be put into the system are indeed unique. I have even hard coded unique IDs into the sub and I still receive the error. I am still able to write to the data source by setting up an AddOrderForm and manually entering the data and using a For All Include statement but that is impracticable for the application. My subroutine is as follows
Case CheckOut Reposition tet_orders.TET_ORDERS.ORDER_ID ; Stack Clear SortAndAddOrderStk ; For All Next tet_orders.TET_ORDERS.ORDER_ID into SortAndAddOrderStk ; Stack Sort SortAndAddOrderStk by highest ORDER_ID ; Compute NewRow = SortAndAddOrderStk.FocCount ; If SortAndAddOrderStk.FocCount EQ 0 Then Compute NewOrderID = 0 Else Compute NewOrderID = SortAndAddOrderStk(1).ORDER_ID ; Compute i=1 ; Repeat GetItemsStk.focCount Compute GetItemsStk(I).Ch = CheckOutForm.GetHTMLField('ChBox' || I) ; Compute i=i+1 ; Endrepeat Stack Clear CheckOutStk ; Stack Copy From GetItemsStk into CheckOutStk Where Ch = 1 ; Compute Today = Today2() ; Compute NextWeek = Today+7 ; Compute i=1 ; Repeat CheckOutStk.FocCount Compute CheckOutStk(i).STATUS = "Checked Out" ; Compute SortAndAddOrderStk(NewRow+i).ORDER_ID = NewOrderId+i ; Compute SortAndAddOrderStk(NewRow+i).ITEM_ID = CheckOutStk(i).ITEM_ID ; Compute SortAndAddOrderStk(NewRow+i).INST_ID = Auth ; Compute SortAndAddOrderStk(NewRow+i).STU_ID = "." ; Compute SortAndAddOrderStk(NewRow+i).STU_NAME = "." ; Compute SortAndAddOrderStk(NewRow+i).STU_CONTACT = "." ; Compute SortAndAddOrderStk(NewRow+i).CHECK_OUT = Today ; Compute SortAndAddOrderStk(NewRow+i).Due = NextWeek ; Compute SortAndAddOrderStk(NewRow+i).CHECK_IN = "." ; Compute SortAndAddOrderStk(NewRow+i).COMMENTS = "." ; Compute i=i+1 ; EndRepeat For all update tet_inventory.TET_INVENTORY.STATUS from CheckOutStk ; For All Include tet_orders.TET_ORDERS.ORDER_ID from SortAndAddOrderStk ; If FocError EQ 0 Then Commit ; Type FocError ; EndCase
You guys are great, you've helped me out a ton in the past hope you can do it again!
Thanks in advance for your reply, David JohnsonThis message has been edited. Last edited by: dcjohnson3,
Ok To start a -22 means you are trying to include a record that already exists. That error is coming from this line: For All Include tet_orders.TET_ORDERS.ORDER_ID from SortAndAddOrderStk ;
This stack contains not only you NEW orders, but all of your existing ones as well. You load it at the beginning of the case. I believe a quick way to fix this is: For All Include tet_orders.TET_ORDERS.ORDER_ID from SortAndAddOrderStk(NewRow+1);
That SHOULD start the include at the new records and ignore the existing ones.
Mark
Posts: 663 | Location: New York | Registered: May 08, 2003
Thanks for your quick reply, it worked like a charm. It's obvious in retrospect but it was really stumping me for a while there. You guys are the best.