1 (edited by kim143 2017-05-19 12:41:07)

Topic: How to Make Pending Value Like This?

How can I Make Pending the way I want it
Please Check out attached Image

thanks

Post's attachments

Attachment icon pending1.png 36.25 kb, 344 downloads since 2017-05-19 

Re: How to Make Pending Value Like This?

Any one like to help me here please smile

Re: How to Make Pending Value Like This?

Hi Kim,
Thanks for the screenshot - I can see exactly what you're wanting to show and I'm sure it can be done as a calculated field but I've not been able to get the syntax correct.
Pretty sure Dmitry will have a way around it.
Derek.

Re: How to Make Pending Value Like This?

It's possible, if every records of ingredients have DATETIME field with different values. Example of calculated field

(
(SELECT cereal.grams FROM cereal WHERE cereal.id=subrecords.id_cereal)  
-
(SELECT TOTAL(s.gram) FROM subrecords s WHERE (s.id_cereal=subrecords.id_cereal) AND (s.date <= subrecords.date )) 
)  
Dmitry.

5 (edited by kim143 2017-05-23 05:58:15)

Re: How to Make Pending Value Like This?

Instead of using date I used counter same query thanks (as you mentioned on home page this program is portable so date and time can be anything on different computer) @Dmitry but I couldn't understand what you have done with Query

(SELECT TOTAL(s.gram) FROM subrecords s...

what is "s" can you please explain or just give me technical word for it I will google it again thanks smile

DriveSoft wrote:

It's possible, if every records of ingredients have DATETIME field with different values. Example of calculated field

(
(SELECT cereal.grams FROM cereal WHERE cereal.id=subrecords.id_cereal)  
-
(SELECT TOTAL(s.gram) FROM subrecords s WHERE (s.id_cereal=subrecords.id_cereal) AND (s.date <= subrecords.date )) 
)  

6 (edited by derek 2017-05-23 09:11:31)

Re: How to Make Pending Value Like This?

Hi Kim,
In Dmitry's solution to your 'pending' question, he needs to use a row in 'subrecords' to then read itself - once to calculate the running total and once to filter all the records that are <= to the particular date of the row.
You can't DIRECTLY refer to the same table twice (it would be ambiguous) so you need to redefine it when it's referred to a second time. 
So when he writes '.....from subrecords s........', he is redefining the second use of 'subrecords' as 's' and then subsequently uses 's.id_cereal=subrecords.id_cereal.id' etc etc.  He could just as easily have redefined it as 'subrecords2' but 's' is easier!
.
As a side issue, I often redefine tables when writing a query or script - not because I'm referring to the same table more than once, but simply to save typing (such bad habits)!  Have a look at the code below:
.
select
a.record_count,
a.salutation,
a.name,
strftime('%d-%m-%y', a.joined),
b.type,
a.phone,
a.email,
a.id
from members a, model b
.
which does exactly the same as -
.
select
members.record_count,
members.salutation,
members.name,
strftime('%d-%m-%y', members.joined),
model.type,
members.phone,
members.email,
members.id
from members, model
.
Hope all of that makes sense.
Regards,
Derek.

Re: How to Make Pending Value Like This?

kim143
Check it out
http://www.w3resource.com/sql/subquerie … liases.php

Dmitry.

Re: How to Make Pending Value Like This?

Hello Community

@Dmitry calculated field only works when I enter the integer value like 100,200 or 10 but when I add float value like 10.2, 1.25 it does not count correctly the pending value

Please check gchild.png image in zip file

Anyone like to help please do so. smile

Post's attachments

Attachment icon releted_tgrid2 (2).zip 37.71 kb, 421 downloads since 2017-05-31