Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fill with previous values
Message
From
30/10/2020 01:30:56
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
30/10/2020 01:10:20
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01676862
Message ID:
01676865
Views:
36
>Dear Experts,
>
> 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)
>
>
>The result looks like this
>https://ibb.co/2c1LxBG
>
>But I need this result
>https://ibb.co/GdNbW0x
>
>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

There are things called variables. They hold there values until changed.
LOCAL lnField1,lnField2
lnField1 = 1
lnField2 = 5.6
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = 2
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = 3
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = 4
lnField2 = 7.8
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = 5
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = 6
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = 7
lnField2 = 7.3
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = 8
Insert Into table1 Values(m.lnField1,m.lnField2)
One might even consider to solve the problem with the incrementing values of Field # 1 like
lnField1 = 0
lnField1 = lnField1+1
lnField2 = 5.6
Insert Into table1 Values(m.lnField1,m.lnField2)
lnField1 = lnField1+1
Insert Into table1 Values(m.lnField1,m.lnField2)
*...
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform