Solved

Getting Id of selected list view row


Hello 

I have a timesheet which consists of a list view and item view along with other.

 

I would like it so that when i double click on a date on a List view it opens up the item view carrying that row Id so i can add certain fields to that date i selected.

 

so far whats hapening is that on the item view it adds a new row per submission instead editing on that date alone.

 

I tried using a parameter to pass the row id on the 'List item double click , open subform' rule the  but i assume im doing it all wrong.

 

any help will be welome 

 

 

icon

Best answer by tbyrne777 31 May 2022, 20:44

View original

10 replies

Userlevel 5
Badge +13
I would try tweaking your open subform rule to only pass in the selected Id as a parameter instead of using data transfer. Then, when your sub form opens, display a message box that includes the value of that parameter to make sure it is actually getting there. Please let us know if the message box is displaying the parameter value or not and we can continue from there

Thank you for your quick response.


yes a different id is being shown for each date selected so i assume its coming through. * sorry i am still adjusting to k2 


 


Is there a rule that can set it so that on each view in the subform the ID is equal to the parameter so that upon submission or initializing , all records displayed or submitted goes under that ID ie. under the selected date ?


 


but ill wait for response thank you.

In the Intializing event of each view of the subform, use the parameter passed to the from to load the relevant data.  

Userlevel 5
Badge +13
Can you please show us what your rules on the sub form look like? Specifically what happens when you click that "Add" button. It sounds like you would want to execute an "Update" on a record using that parameter value instead of executing a "Create" which is what I assume is happening right now

yes 100% im currently using a create method i have no experiance with an Update. you understand what i want. Could you guide me on how to do that ?


 


would an update rule allow me to pass in the parameter to the Smart Object ID so that it can update that date record?


 


All im looking for is that for each date i open i can add entries that go specifically to that date which would be that specific ID.

Userlevel 5
Badge +13
Please change "Create" to "Update" on the rule that calls your test SmartObject. When you configure it, it will require an ID as a parameter. Drag in the value that you passed in from the main form and you'll be all set!
Thank you for all the help , works fantastic.
Just curious is there a way i can also add multiple submissions under one ID example : submitting multiple tasks per date.

So is there a smartobject rule whereby i can click the add button and it adds onto the record for that Date. becuase i know an update will just keep updating the record which if fine if theres no other way.

This is a classic 1 to many (1:M) entity relationship found in nearly all business applications. You can easily handle this in SmartForms. In the record where you are storing the many items related to the primary entity (that has something to do with date) you add a column that refers to the key of your primary entity.  This is commonly referred to as a foreign key.  Populate this value and it creates a relationship between the two entities.  You can use the SmartObject Create or Update method as needed.  There are several ways to do this and there are corresponding SmartForm rules that can be used. 


 


One way is to use a foreach rule to iterate the listview so you can organize it something like this:


For each Item in the list


    If the item was added, invoke the Create method of the SmartObject


    If the item was updated, invoke the Update method of the SmartObject


    If the item was deleted from the list invoke the Delete method of the SmartObject


 


Alternatively you could have toolbar buttons that immediately add/update/delete the item when clicked.


 


If you would like one-on-one help or mentoring, you can reach out to your customer service manager and discuss options for Technical Analysis Services (TAS).  That is a service we offer that can provide one-on-one coaching.

Thanks David , No its ok i have full on understanding on how to achieve this from what you explained.

Reply