locked
Fill with previous value RRS feed

  • Question

  • Sir I have these codes

    Create Cursor table1 (sno N(3), ratio N(5,2))
    Insert Into table1 Values(1,5.6)
    Insert Into table1 Values(2,0)
    Insert Into table1 Values(3,0)
    Insert Into table1 Values(4,7.8)
    Insert Into table1 Values(5,0)
    Insert Into table1 Values(6,0)
    Insert Into table1 Values(7,3)
    Insert Into table1 Values(8,0)

    It shows data like this

    I want to fill empty ratio with like this

    Example:

    record 1

    ratio is 5.60

    record 2

    ratio 0

    Want to fill record 2 with 5.60 until next ratio is found.

    Please

    I am trying these codes

    Go Top
    
    bb=ratio
    Scan
    	Locate For ratio=0
    	If Found()
    		Replace  ratio With  bb For ratio=0
    	Else
    		Exit
    	Endif
    	If !Eof()
    		Skip
    	Endif
    
    	bb=ratio
    Endscan
    Brow
    

    But wrong result.


    tqmd


    Thursday, October 29, 2020 12:14 PM