Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Issue with BOT Not Deleting Filtered Records in Second Table

 

Hi friends, I am trying to delete records from another table using a BOT that executes a "Delete" action from that table, already created by the system, on a set of rows from that same table.

The idea is that, upon deleting a record from the first table (E_COMPONENTS_TUAD), the BOT activates on the second table (E_BOM_TUAD), executing an action on a set of rows.

The expression I use is this:

 
FILTER(
        "E_BOM_TUAD",
        AND(
            OR(
                IN(
                    [_THISROW].[E_PRODUCTIONS_G3_TUAD],
                    [E_PDISMEMBER_TUAD].[E_SUBPRODUCTIONS_TUAD].[Subproducciones_Anidadas]
                    ),
        [E_COMPONENTS_TUAD_SupplieG3].[E_PRODUCTIONS_G3_TUAD] =
        [_THISROW].[E_PRODUCTIONS_G3_TUAD]
              ),
       [E_COMPONENTS_TUAD_SupplieG3] = [_THISROW].[ID]
           ) 
          )

It works halfway:

It is not deleting the records I have marked in red.

Can someone tell me why? I swear I have no idea.

As an additional note, I created a virtual column in the first table to see which row is being filtered, and the filtering is correct; it returns exactly the rows I want to delete. However, the action does not delete them.

I will leave a picture of my tables for context. Regards, thanks.

E_COMPONENTS_TUAD

1.0.png

E_BOM_TUAD

2.0.png

Solved Solved
0 3 342
1 ACCEPTED SOLUTION

I am not seeing anything that would prevent selection of the E_BOM_TUAD rows for deletion.  So I think there might be something else preventing these rows from being deleted.  Make sure DELETES are enabled for the table/slice.

Additionally, these two statements below are doing the same thing, you do not need both of them:


@Gustavo_Eduardo wrote:

        [E_COMPONENTS_TUAD_SupplieG3].[E_PRODUCTIONS_G3_TUAD] =
        [_THISROW].[E_PRODUCTIONS_G3_TUAD]
              ),
       [E_COMPONENTS_TUAD_SupplieG3] = [_THISROW].[ID]


An Easier Way??

If you are simply trying to delete rows in E_BOM_TUAD that have a REF to the deleted row in E_COMPOMEMTS_TUAD,  there might be an easier way. 

Turning on the "Is part of" property on the column "E_COMPONENTS_TUAD_SupplieG3" creates a "strongly coupled" Parent/Child relationship.  Then anytime you delete a row in "E_COMPONENTS_TUAD", all rows in E_BOM_TUAD that having a matching REF value in column "E_COMPONENTS_TUAD_SupplieG3" will also be deleted automatically

This assumes that you don't already have another column with the "Is part of" property turned on.  It also assumes that you don't have other conditions to determine if the child rows should be deleted.  

I hope this helps!

View solution in original post

3 REPLIES 3

I am not seeing anything that would prevent selection of the E_BOM_TUAD rows for deletion.  So I think there might be something else preventing these rows from being deleted.  Make sure DELETES are enabled for the table/slice.

Additionally, these two statements below are doing the same thing, you do not need both of them:


@Gustavo_Eduardo wrote:

        [E_COMPONENTS_TUAD_SupplieG3].[E_PRODUCTIONS_G3_TUAD] =
        [_THISROW].[E_PRODUCTIONS_G3_TUAD]
              ),
       [E_COMPONENTS_TUAD_SupplieG3] = [_THISROW].[ID]


An Easier Way??

If you are simply trying to delete rows in E_BOM_TUAD that have a REF to the deleted row in E_COMPOMEMTS_TUAD,  there might be an easier way. 

Turning on the "Is part of" property on the column "E_COMPONENTS_TUAD_SupplieG3" creates a "strongly coupled" Parent/Child relationship.  Then anytime you delete a row in "E_COMPONENTS_TUAD", all rows in E_BOM_TUAD that having a matching REF value in column "E_COMPONENTS_TUAD_SupplieG3" will also be deleted automatically

This assumes that you don't already have another column with the "Is part of" property turned on.  It also assumes that you don't have other conditions to determine if the child rows should be deleted.  

I hope this helps!

@WillowMobileSys "I have resolved it as you suggested (although to be 100% honest) I have not yet tested as many options as possible to verify its correct functioning. For now, it's working and working well. But I should check for bugs since the logic I created is complex. I am making a BOM (Bill of Materials) with nested productions. I will mark it as solved (but if I need to revisit it, I will return to the post to see if you can help further). For now, I thank you very much because it's working fine so far.

First of all, I really appreciate your response @WillowMobileSys. I will try what you suggested and will keep you posted, my friend

Top Labels in this Space