Thursday, June 29, 2017

北京故宫中轴线偏差


上图是一个YouTube视频。 论点是“元代人为中轴线偏差”。后来又看了郭晓强的文章(http://idea.cas.cn/viewdoc.action?docid=42614)觉得后者有理由。

郭晓强说夔中羽是用北京时间不是北京当地时间。这话没错。元朝时都还没格林威治标准时间那理有北京统一时间?

每四年都有多一天。因为是用阳历。元朝用阴历。阳历是辛亥革命后才用的。夔中羽用2004年的天文日历。会不会有时差呢?

夔中羽自己做了日晷。用2004年的天文日历为准。视频没说怎样调准。会不会是太不科学的量法吧?正确的做法应该用日晷确定何时是零地点正午后才来与故宫中轴线比较。元朝人大概也是如此量法。

当然与700年前的正午标准时间比现在正午时间那可要一切都不变。事实是如此吗?我们连元朝人哪月量的都不知道。地壳一直在移动。地球又不是正园形绕太阳转动。轴心也不是与太阳成正角。而且宇宙都一直在膨胀。用如此简陋的量法真的很难说服人。

当然以一个外行人来批评学者是不对的。不过外行人都觉得不大对,其他学者又没说那又是谁对呢?


Thursday, June 08, 2017

Doing a Filemaker PO

Doing a PO is quite simple thing. It gets a bit tricky when you want to create PO number and do sums that is stored in the main table while the PO items is in the related table and fill in the items one by one. Each record is related to the main table by the PO number.

First the main table must have a self increment field. This will act as the PO number. You can add prefix or post fix with it. And to add in the fun you can do "Right('00000' & table::idfield;6)" to get a nicely formatted 0 pre-pended text and store it in another calculated field.

The first thing to do is create the relation. Drag the previously mentioned calculated field to join to the sub-table field. Now click on the link itself and it will display a pop up like this


The trick is to check "Allow creation of records in this table via this relationship". When you check this you are actually telling FM to create the record with the specific PONo::POID value inserted into PO::Po Number automatically if you start to fill in PO fields. The relation will be automatically created this way. PO table will also add new record for you automatically. Lets go to the layout to do a practical.

In the layout You add PO Date and Supplier from PONo. You will then create a portal and choose PO as the relation table. It will prompt you for what fields in PO to add to the portal. Just choose any fields other than PO Number. Add the appropriate field name title. Exit editing after that.

Now you can add records. First click "Add Record" from the menu. It will add a new Record in PONo table. Fill in PO Date and Supplier. Click the top left end of the portal and you can enter the PO table fields without having to create the record. It will self create and automatically add the relation field info to establish the relationship. You can continue to click on the area below the last record to create more records.

The next trick is to do calculations. The PO table have a Unit price and a quantity field. There is a field that do the sub price by multiplying Unit price with Quantity. There is also a summary field that sums the sub price (not incremental). This is the field that we are suppose to update back to PONo table. The PONo also have a GST calculation that add a specific percentage of tax. Finally, there is a total sum field to show the total sum.

Now getting the summary field back to PONo is no issue. Just do a calculated field at PONo to get the PO summary field value. The GST and the Total value is then calculated from there.

Problem appears once you try to do this. The calculated fields in PONo will just go blank once you add some Unit Price and Qty. I don't know whether it is Filemaker bug or not but it gets irritating to not be able to see the calculated value.

Luckily there is a way out. The method used is "script triggers". On the Unit Price and Qty field, add a trigger "on Object Exit" for both. The trigger script will do a object refresh by name. You should name Unit Price and QTY plus the overall total field. Refresh all three fields in sequence and you solved the issue. You may want to do "commit" first before doing refresh.

On the report layout just use a list form and put PO fields in the body with the PONo fields in header or footer accordingly. You just got yourself a nicely done PO report.