Created
December 22, 2019 00:16
-
-
Save jbratu/f98dca5a6ce8d319dac12dea725cbe10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function CS_REMOVE_ITEMS_FROM_LIST(ListName, ItemsToRemove, Delim) | |
$Insert Logical | |
Declare Subroutine Set_Status | |
Open 'SYSLISTS' To Table Else | |
Set_Status(-1,1,'Unable to open syslists table') | |
Return | |
End | |
Read Rows From Table, ListName Else | |
Set_Status(-1,1,'Unable to read list') | |
Return | |
End | |
StripItems = ItemsToRemove | |
Swap Delim With @FM In StripItems | |
StripItemsCount = DCOUNT(StripItems,@FM) | |
RowsCount = DCOUNT(Rows,@FM) | |
RowsNew = '' | |
RowsNew<1> = Rows<1> | |
RowsRemoved = '' | |
*Loops through all the rows looking for things to remove | |
For i = 2 To RowsCount | |
Row = Rows<i> | |
*Assume that the item will not be removed | |
RowRemoved = False$ | |
*Loop through all the things that cause the row to be removed | |
For j = 1 To StripItemsCount | |
StripItem = StripItems<j> | |
*Does this thing cause the row to get removed? | |
If Index(Row, StripItem, 1) > 0 Then | |
*Yes | |
RowRemoved = True$ | |
*Keep a list of the rows that we removed | |
RowsRemoved<-1> = Row | |
j = StripItemsCount ;* break the loop | |
End | |
Next j | |
If RowRemoved = False$ Then | |
*The row wasn't removed so store it for writing later | |
RowsNew<-1> = Row | |
End | |
Next i | |
Write RowsNew On Table, ListName Else | |
Set_Status(-1,1,'Unable to update list') | |
Return | |
End | |
Return RowsRemoved |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment