How to control add, update, and delete operations based on row values

I have an app to create quotes which have a number of quoted items. It has a table for quotes and a related table for quote items. The quote table has a status column to record if the quote is developing, issued, accepted or rejected. I want that the data in the quoteitems tables to be editable only when the quote status is "developing".

I have tried using the following code to use different slice for the related quoteitem VC in the column table where the "NonDeveloping Quote Items" is set to read only

 

switch([_thisrow].[status],

"developing",REF_ROWS("Developing Quote Items", "Quote"),

REF_ROWS("NonDeveloping Quote Items", "Quote")

)

 

The conditions for the two slice where as follows and they gave the correct output:

 

lookup([_thisrow].[quote],"quotes","row id","status")="developing"

lookup([_thisrow].[quote],"quotes","row id","status")<>"developing"

But this did not work as expected outcome because when I clicked on a related quoteitem in the detail for it opened the editable quoteitem view

It seems like the only way to do this is to set the editable condition of each column in the table individually. But this means that if there is an error I have to go back and change each one. 

Is there a more practical way to achieve this?

 

 

Solved Solved
0 7 326
3 ACCEPTED SOLUTIONS

Just occurred to me that I had to go a couple more steps with my approach. I created a detailed view for each slice and an action to select which tetail view to open based on the quote status. Thus did the job. But I still need to stop the add action from appearing when the quote is not in the developing mode. 

I would also welcome a simpler way of achieving the same result from the experts.

View solution in original post

Please try below.

Please create a read write slice called say "Developing Quote Items" and another read only slice called say " Completed Quote Items". Both slices on the Quote Items table. 

Please add two columns in the Quotes table. One column called [Related Developing Quote Items] with an expression something like 

REF_ROWS("Developing Quote Items" , "Quotes Table key")

The referenced table name should be "Developing Quote Items" in this reference rows column's Referenced Table name setting. 

The show_if of this column can be [Quote Status]="Developing"

The second column called [Related Completed Quote Items] with an expression something like 

REF_ROWS("Completed Quote Items" , "Quote Table key")

The referenced table name should be "Completed Quote Items" in this reference rows column's Referenced Table name setting. 

The show_if of this column can be [Quote Status]<>"Developing"

 

View solution in original post

Thank you. Yes I noted  you have created slices etc.  My suggestion was from your statement that you still wanted to prevent "add" to the Quote Items table that probably was not happening as per your earlier query. So just described the approach in detail to achieve the same- prevent edits as well as adds. 


@SIDHR wrote

But I still need to stop the add action from appearing when the quote is not in the developing mode.


 

 

View solution in original post

7 REPLIES 7

Just occurred to me that I had to go a couple more steps with my approach. I created a detailed view for each slice and an action to select which tetail view to open based on the quote status. Thus did the job. But I still need to stop the add action from appearing when the quote is not in the developing mode. 

I would also welcome a simpler way of achieving the same result from the experts.

Please try below.

Please create a read write slice called say "Developing Quote Items" and another read only slice called say " Completed Quote Items". Both slices on the Quote Items table. 

Please add two columns in the Quotes table. One column called [Related Developing Quote Items] with an expression something like 

REF_ROWS("Developing Quote Items" , "Quotes Table key")

The referenced table name should be "Developing Quote Items" in this reference rows column's Referenced Table name setting. 

The show_if of this column can be [Quote Status]="Developing"

The second column called [Related Completed Quote Items] with an expression something like 

REF_ROWS("Completed Quote Items" , "Quote Table key")

The referenced table name should be "Completed Quote Items" in this reference rows column's Referenced Table name setting. 

The show_if of this column can be [Quote Status]<>"Developing"

 

@Suvrutt_Gurjar  As mentioned in the original post I did basically what you are suggesting. Only difference is that I used a switch function to select which slice to us. The problem was that there was no form and detail views created for the slices. So when users clicked the quoteitem detail form opened. As noted in the response to my own question I have since address this by creating views for each slice.

The remaining problem is to stop the "add" action when the quote is not in developing stage. The code I am using to condition the action is not working:

lookup([_thisrow].[quote],"quotes","row id","status")="developing"

It disable the action all the time even in developing stage.

 

 

Thank you. Yes I noted  you have created slices etc.  My suggestion was from your statement that you still wanted to prevent "add" to the Quote Items table that probably was not happening as per your earlier query. So just described the approach in detail to achieve the same- prevent edits as well as adds. 


@SIDHR wrote

But I still need to stop the add action from appearing when the quote is not in the developing mode.


 

 

@Suvrutt_Gurjar  OK got you now. I have tried your approach and it does deal with the add action problem.

Thank you for the update. Good to know the approach works per your requirement.


@SIDHR wrote:

The remaining problem is to stop the "add" action when the quote is not in developing stage. The code I am using to condition the action is not working:


If you carefully look at the description of the "add" action, you will notice a sentence " not a row level action". Add actions, unlike some other data change actions are NOT row level actions. One adds row to a table, not to another row. So one CANNOT  use row level conditions expressions  to disable the " add" actions. One can use row level conditions for Edit action or some other row level data change actions.

Hence the need to create "read write" and " read only" slices with other procedure as described. 

 

 


 

 

Top Labels in this Space