Expense Claim Form: "ADD TOOLBAR BUTTON" ,"ADD button of ITEM SUBFORM" and "SUBMIT" button on Form

  • 24 April 2014
  • 9 replies
  • 0 views

Badge +2

Dear All,

 

Please check the attachment, here I wanted to know how to handle Master-Detail Insert of Expense Claim form demo, because in MASTER-DETAIL, always first master record is inserted then parent ID is return and passed to DETAIL section for insert...

But in the DEMO I see multiple claims are added, hence is there any temporary storage where claims are stored till user click the SUBMIT button on bottom the FORM ???...

 

Hence Please let me know the rules that need to be written in the rule section of "ADD TOOLBAR BUTTON" and "ADD" button of ITEM SUBFORM so that the record is added to DETAIL but the entire batch is COMMITEED only when user click on SUBMIT button.

I'm curious to know the RULES written on the "ADD TOOLBAR BUTTON", "Add button ITEM SubForm", "SUBMIT Button" and how MASTER-DETAIL record is handled here by rules.

 

If any have has complete article or complete video link on this Expense Management with K2, Please do forward and post the link...

 

13082iE2321491D009B9E9.png

 

Thanks in advance and kindly appricate your reply.

 

Regards,
SamA


9 replies

Badge +6

Hi SAMAnsari,


 


Please have look at the following link below which discusses the expense claim with K2:


 


http://help.k2.com/en/displaycontent.aspx?id=4244


 


Regards,


 


Yannick


 

Badge +2
Hi Yannick.
 
I'm sorry, but I made the problem screen shots from this video only... Here K2 guy had demonstrated this video only for marketing providing no technical details and all video follow the same rule on K2 website. if they would have  explained business rules for 2-4 minute by opening the form in design mode then all videos would have been worth to watch...
 
Please can your provide what rules are written behind the buttons that I have asked in the snapshot...
 
Regards,
SamA 

 

Badge +7

What I would do in this scerio is build the an item view called Add New Item:

14443i59B7BDD2A320EBE0.png

 

When the First Add button is clicked, the first rule would be to open a subview and point it to the above view.

 

When the Add button is clicked on the (now called subview), it will fire a CRUD method to what ever backend you have in-place to update your Expense claim.  So something like When Add Button is Clicked, Then excute the SmartObject Method execute (configure).  After the smartobject fires, you have to close the subview...so the next rule will be "close the subview or subform".  I would put that close rule on the cancel as well.

 

The last (tricky) rule will be "When a subview is closing".  I throw this one in to make sure my list view (i.e. Expense Item Details) gets refreshed.  So it will look like When Addnewitem view is closing, then on "Expense Item Details" view excute the list refresh method.

 

Let me know if you have more questions.  I should be able to drill into more tomorrow if you need help.

Badge +2

Hi Daerne,

I've added the below logic and rules, please check the attachment

Logic in ClaimEditableListView:
When ADD TOOLBAR BUTTON CLICKED
   A) then open CLIAMITEM as SUBVIEW

Logic in ClaiItemView:
When ADD BUTTON is CLICKED
   then complete the following one after another
   A) then EXECUTE the SMARTOBJECT CREATE method
   B) then CLOSE a subview or subform
   C) I Was NOT able to find any way to refresh method to refresh the grid on Parent form
 
ISSSUES:
This is volition of principle of master-detail as CLAIMS(child table) record is added by SMARTOBJECT CREATE method, and the foreign key value of ExpenseID is also blank...
I Was NOT able to find any way to refresh method to refresh the grid on Parent form

Here something is missing, we need have rule which adds a record and refresh the grid but the data should only be committed as BATCH only when user clicks the SUBMIT button on the Parent FORM. Hope you understood the problem,
Hope you understood the problem,

Regards,


16404iBAD3BCD25A8BAF96.png
Badge +7

You are attempting one of the more tricker parts of how to pass data (Expense ID) from the parent to child.

 

If your main form is rendered with a main ExpenseID, you need to now be able to pass that to any view element within your solution.  The way you handle passing the ExpenseID to your subviews or subforms, is by creating a Parameter on that view.  So in this case on the Expense subview, you'll edit the properties and add the paramter ExpenseID.  With that in place, you can now pass the main form's ExpenseID to your subview.

 

Modify View (subview) with new parameter:

10961iFB97B5714EA139D3.png

Now when you map in your smartobject with the Create method, you map in the ExpenseID parameter from the Subview.

 

Give that a shot and let me know if its working.

Badge +2

Hi Daerne,

Hope you understand the bigger part of the problem, creating passing parameter is easier.... Please can you advice on SUBMIT button and ON CLICK TOOLBAR button, I want the following...

1) User Open the expenses form.

2) User enter the Expenses data( Header ), user had not saved the header, and he has not pressed submit, hence no EXPENSEID present till yet.

3) User enter the Claim (child), He click on ADD TOOLBAR Button

   Here where should the form get the ExpenseId because the HEADER PART is still not saved?... Also when I ADD & CLOSE the subform i.e CLAIM, the record is added to CLAIM TABLE, because we are calling SMARTObject CREATE METHOD.

  Question: I want to know the rule how to handle this case and get Expense Id because the record is still not created and also record should not be added to the table permently it should be commited only when user CLICK SUBMIT Button…

4) Now User again clicks ADD TOOLBAR Button, to add second claim... but again this will result the same the record bein created in CLAIM but EXPENSE HEADER is still not saved.

  Question: I want to know rule how to handle this case….

5) Now user click on SUBMIT, Actually I want at this point the all record to be created in TABLE first EXPENSE (PARENT) and THEN I get the EXPENSESId and Then Pass it as output , the EXPENSE ID to CLAIM(CHILD)..

  Question: I also want to know rule how to handle this case, Say have not CLICKED Submit, and user has closed the form or pressed cancel then record created in claim should also be rollback...

Hope you got the problem.

Regards

Badge +2

Please do you have any idea on my question....

-Regards

Badge +2

Dear  All,

 

attached is the answer!

 

-Cheers


16451i75BAC789F91DA453.png
Badge +2

In my case sub form "close" button close the sub form in designer..but when i run the same from "runtime" its not work 

for testing purpose i just add simple form with sub form In main form i put the button which open the sub form and in sub form there is just a close button to close the form ..its work fine in designer but not in runtime...client is sufferening and angry :(

Reply