URGENT! types aren't deleted
Blitz3D Forums/Blitz3D Beginners Area/URGENT! types aren't deleted
| ||
I have this problem...look this code... Function delete_master_category2() anyrow.DataBaseRow=First DataBaseRow k=countrow(anyrow) ; with this count Databaserow type in memory.. anyrow.DataBaseRow=First DataBaseRow For anyrow.DataBaseRow=Each DataBaseRow linearictipo.RicTipo=First RicTipo While After linearictipo<>Null catmerc$=linearictipo\Catmerc If anyrow\catmerc=catmerc Then k=1 Exit EndIf linearictipo=After linearictipo Wend If k=0 Then Delete anyrow.DataBaseRow ; delete if not present in liearictipo... EndIf Next anyrow.DataBaseRow=First DataBaseRow k=countrow(anyrow) ; AT THIS TIME NOTHING BE DELETED.. anyrow.DataBaseRow=First DataBaseRow For anyrow.DataBaseRow=Each DataBaseRow intero%=anyrow\dispo If intero<10 Then Delete anyrow.DataBaseRow EndIf Next anyrow.DataBaseRow=First DataBaseRow k=countrow(anyrow) ; AFTER THIS INSTEAD SOME TYPES RESULT DELETED BUT NOT ALL End Function |
| ||
It all seems a little messy to me., I'm not sure what your attempting or where the problem may come in, but I've added some coments below to highlight what may be important factors. Generally speaking, I would suggest perhaps using nested For/Each loops rather than the First / After This might make things a little easier and ought to produce exactly the same results codewise. Again, I'm not sure what your code represents from the sample you supplied, but I made a best-guess: Function delete_master_category2() Local linearictipo.RicTipo Local Anyrow.DataBaseRow Local k Local intero For Anyrow.DataBaseRow=Each DataBaseRow For linearictipo.RicTipo=Each RicTipo k=Countrow(Anyrow) ; with this count Databaserow type in memory.. If (k=0) Delete Anyrow.DataBaseRow EndIf If (Anyrow\Catmerc=linearictipo\Catmerc) k=1 linearictipo=After linearictipo EndIf Next If (Anyrow\dispo<10) Then Delete Anyrow.DataBaseRow EndIf Next End Function |
| ||
thanks for you help..but..code make what i want in logic.. i refer to.. anyrow.DataBaseRow=First DatabaseRow ; point anyrow var to first type.. k=countrow(anyrow) ; with this count Databaserow type in memory..it's a for each with a count var that is the value of k... so it don't affect other calculus...now i think i have just make an idiot error because i use var k without controll first his value...so after k=countrow(anyrow) ; that i want use for debug... i make this...(excuse me) k=0 inside for next.. ando so i think that code works fine...thanks and i repeat excuse me Last edited 2012 Last edited 2012 Last edited 2012 |