PIM.cphrase

Here you can browse the full PIM.cphrase. Note the use of views and reports.

<?xml version="1.0" encoding="UTF-8"?>
<config id="PIM" name="PIM" db="sqlite:PIM.db" language="english" version="1.0.15" description="">

    <table id="Note" writes="full">
        <column id="id" type="int"/>
        <column id="title" type="text"/>
        <column id="type" type="text"/>

        <primary_key key="id"/>
        <primary_value key="title" />
    </table>


    <table id="Note_Attachment" writes="full" lex="photo attachment,photo attachments">
        <column id="note" type="int" select="false"/>
        <column id="file" type="file"/>

        <foreign_key from="note" to="Note"/>
    </table>


    <table id="Exercise" writes="full" lex="exercise,exercises">
        <column id="id" type="int"/>
        <column id="type" type="text">
            <value val="bicycle"/>
            <value val="desk work"/>
            <value val="hard labor"/>
            <value val="kettlebell"/>
            <value val="outside time"/>
            <value val="run"/>
            <value val="run/walk"/>
            <value val="skiing"/>
        </column>
        <column id="date" type="date" default="(date('now'))"/>
        <column id="description" type="memo"/>
        <column id="measure_title" type="text"/>
        <column id="measure" type="real"/>

        <primary_key key="id"/>
    </table>


    <table id="Task" writes="full" lex="task,tasks">
        <column id="id" type="int"/>
        <column id="name" type="text" notnull="true"/>
        <column id="priority" type="text" notnull="true">
            <value val="high"/>
            <value val="low"/>
            <value val="medium"/>
        </column>
        <column id="severity" type="text" notnull="true">
            <value val="high"/>
            <value val="low"/>
            <value val="medium"/>
        </column>
        <column id="posted" type="date" default="(date('now'))"/>
        <column id="starred" type="boolean" default="0"/>
        <column id="notes" type="memo"/>
        <column id="task_type" type="int" default="1" select="false"/>

        <primary_key key="id"/>
        <foreign_key from="task_type" to="Task_Type"/>
        <primary_value key="name" />
    </table>


    <table id="Task_Type" writes="full" lex="project,projects,task category,task categories,task type,task types">
        <column id="id" type="int"/>
        <column id="name" type="text"/>
        <column id="area" type="text" properties="+value-stands-for-table"/>
        <column id="description" type="memo"/>

        <primary_key key="id"/>
        <primary_value key="name" />
    </table>


    <table id="Eating" writes="full" lex="eating,eatings,ate,eaten">
        <column id="food" type="text" lex="food" select="false"/>
        <column id="date" type="date" default="(date('now'))" lex="when" properties="+value-stands-for-column"/>
        <column id="helping" type="real" default="(1.0)" units="portions" lex="helping,helpings,quantity"/>
        <virtual_column id="id" type="text" properties="-project">

<![CDATA[
replace(replace($VAR.food,',',''),'''','') || $VAR.date
]]>
</virtual_column>

        <primary_key key="id"/>
        <foreign_key from="food" to="Food"/>
    </table>


    <table id="Food" writes="full" lex="food,foods">
        <column id="name" type="text" notnull="true" properties="+like"/>
        <column id="calories" type="real"/>
        <column id="notes" type="memo"/>

        <primary_key key="name"/>
    </table>


    <table id="Journal" writes="full" lex="journal,journals">
        <column id="id" type="int"/>
        <column id="posted" type="date" default="(date('now'))"/>
        <column id="notes" type="memo"/>

        <primary_key key="id"/>
    </table>


    <view id="Daily" lex="calorie report,calorie reports">
        <column id="date" type="date"/>
        <column id="calories" type="real"/>

        <primary_key key="date"/>

<![CDATA[
select sum(helping * calories) as calories, date
from Eating, Food
where eating.food = Food.name
group by date
]]>
</view>


    <report purview="Daily" handler="bar">

<![CDATA[
SELECT date, calories FROM ($SUB)
]]>
    </report>


    <report purview="Task" handler="table">

<![CDATA[
SELECT edit,id,name,posted,LENGTH(notes) as note_length FROM ($SUB) ORDER BY name ASC
]]>
    </report>


    <report purview="Food" order="ORDER BY upper(name)" handler="table">

<![CDATA[
$SUB $ORDER
]]>
    </report>


    <report purview="Note_Attachment" handler="table" lex="raw">

<![CDATA[
$SUB $ORDER
]]>
    </report>


    <report purview="Note_Attachment" handler="table">

<![CDATA[
SELECT DISTINCT
  (SELECT Y1.title FROM Note as Y1 WHERE Y1.id = X1.note) as note_title, '<img src="static/files/' || X1.file || '"/>' as image
 FROM ($SUB) AS X1
]]>
    </report>

    <cascade >
        <pre from="order by" to="order by increasing" description=""/>
    </cascade>

</config>