计数是勾选框 [英] Counting yes tick boxes

查看:73
本文介绍了计数是勾选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一点背景。


我有一个记录报纸发货的数据库。要输入新订单,请输入客户详细信息等,然后表格中有7个复选框,每天一个。用户将勾选该框以指示客户希望当天交付的纸张。因此,例如,如果客户想要监护人的星期一,你会把他们的详细信息,然后报纸标题然后打勾星期一,星期二,星期三,星期四,星期五盒子。


要计算报表中的发票,我需要将纸张在一周内交付的次数乘以纸张的成本。但要做到这一点,我需要总结每条记录的是的滴答数。 count函数只允许我按字段计算。因此,我最终会得到星期一字段中的肯定滴答数,这对我来说毫无用处。


我希望这很清楚,并感谢任何帮助!谢谢!

A little background.

I have a database to record newspaper deliveries. To enter a new order, you input the customer details etc, and then there are 7 tick boxes in the table, one for each day. The user will tick the box to indicate the customer wants the paper delivered that day. So for example if the customer wants the Guardian mon-fri you would put in their details, then the newspaper title then tick the monday, tuesday, wednesday, thursday, friday boxes.

To calculate the invoice in a report I need to multiply the number of times the paper was delivered in a week, by the cost of the paper. But to do this I need to sum the number of yes ticks per record. The count function only lets me count by field though. So I would end up with the number of yes ticks in the monday field, which is useless to me.

I hope this is clear enough, and would appreciate any help! Thank you!

推荐答案

您可以直接在报表基础查询中对字段求和。

金额: - (FieldMonday + FieldTuesday + ...)

为此,字段需要默认值为0(False),因为如果字段没有默认它们将是Null,它们不能一起添加。


前面是因为TRUE表示为-1。因此,星期五到星期五交付的所有真实值的总和为-5,在所示的示例中给出5。
You can sum the fields directly in your reports underlying query.
Amount: -(FieldMonday+FieldTuesday+...)
For this to work, the field needs to have a default value of 0 (False), because if the fields have no default they will be Null which cannot be added together.

The - in front is because TRUE is represented as -1. So a sum of all the true values for delivery monday to friday would -5, giving 5 in the example shown.


或者为每天设计一个求和查询,另一个基于第一个五,总结所有日子。
Or design a sum query for each day and another one, based on first five, to sum all days.


如果您的日期类型全部为enum(''0'',''1'')


那么查询可以是
if your days type is all enum(''0'',''1'')

then the query can be
展开 | 选择 | Wrap | 行号


这篇关于计数是勾选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆