Easy to Create, Easy to Change - Easy to use!


Use ExecDQL instead of traditional DQL - Calendar database


Started by Marco Marchesi
Search
You will need to Sign In to be able to add or comment on the forum!

Use ExecDQL instead of traditional DQL - Calendar database

EXEC DQL is Very interesting way of programming but Can I get a sample database with Calendar in version 8.2 ? (pls see blog) Thanks

Written by Marco Marchesi 15/10/15 at 13:19:36 Dataease [{8}]FIVE

Re:Use ExecDQL instead of traditional DQL - Calendar database

Hi. This will NOT work in 8.2

It uses all new features that is only available in 8.5

Written by DataEase 16/10/15 at 16:26:35 Dataease [{8}]FIVE

Re:Re:Use ExecDQL instead of traditional DQL - Calendar database

The Calendar here is simply a DQL with body like this.

I use the same DQL script for all my calendars, then just make different layout

You see the strength of DQL vs. normal techniques because you can insert bits of code on “event”. Like New Row, Sunday etc.

DQL Script

define "telle" number .

define "JumpDown" text 100 .

define "hdcolor" text .

define "bkcolor" text .

define "vDay" text .

define"vHidden" text .

define "vMonth" text 100 .

define "nextPeriode" text .

define "prevPeriode" text .

define "vvMonth" number .

define "vvYear" number .

define "vPeriode" text .

define "vDate" text .

vPeriode := if (data-entry field4 = blank , concat(lastc(current date,2),midc(current date,4,2)),data-entry field4) .

vMonth := concat(Spellmonth(lastc(vPeriode,2))," 20", firstc(vPeriode,2)) .

vDate := data-entry field3 .

For CalendarDay with Periode = vPeriode ;

vvMonth := lastc(vPeriode ,2) .

vvYear := firstc(vPeriode , 2) .

if vvMonth = 1 then

prevPeriode := concat(vvYear-1,"12") .

else

prevPeriode := concat(vvYear,lastc(concat("00",vvMonth-1),2)) .

end

if vvMonth = 12 then

nextPeriode := concat(vvYear+1,"01") .

else

nextPeriode := concat(vvYear,lastc(concat("00",vvMonth+1),2)) .

end

telle := Telle + 1 .

if date = blank then

hdcolor:="#D3D7E1" .

bkcolor:="#D3D7E1" .

vHidden := "Hidden" .

vDay := blank .

else

hdcolor := "#0072BC" .

bkcolor := "white" .

vDay := day(date) .

vHidden := "Visible" .

end

if telle =7 then

Telle := 0 .

jumpdown :=StringEscape("</tr><tr style=/'vertical-align:top;/'>") .

hdcolor := "#C00000" .

else

jumpdown := "" .

hdcolor := "#0072BC" .

end .

list records

nextPeriode ;

prevPeriode ;

vMonth ;

Date ;

vDay ;

vDate ;

hdcolor ;

vPeriode ;

bkcolor ;

vHidden ;

JumpDown .

End

BODY

<style>

.Available {background-color:#E6FFF2;color:#0072BC}

.Booked {background-color:#FFC1C1;color:#0072BC}

.Reserved {background-color:#FFDFB0;color:#0072BC}

.BookingThis{background-color:##66CBEA;color:#;}

</style>

<div class="panel panel-success" >

<div class="panel-heading">Pick a date to view availability</div>

<div class="panel-body" style="position:relative;"><div style="position:absolute;right:10px;top:0px;"><h2>[{vMonth}]</h2></div>

<a type="button" href="?field1=[{prevPeriode}]&field2=[{vResort}]&ResortID=[{vResort}]" class="btn btn-info"> < Previous Month</a> <a type="button" href="?field1=[{nextPeriode}]&field2=[{vResort}]&ResortID=[{vResort}]" class="btn btn-info">Next Month ></a>

<table style="width:100%;height:100%;">

<tr style="height:16px">

<td >Monday</td><td>Tuesday</td><td>Wednesday</td><td>Thursday</td><td>Friday</td><td>Saturday</td><td style="color:red">Sunday</td>

</tr><tr style="vertical-align: top;">

.items

<td style="width:14%;height:100px;border:solid 1px grey;background-color:[{hdcolor}];Overflow:hidden;visibility:[{vHidden}]">

<a href="/DayView/?Date=[{Date}]&field1=[{Date}]&field3=[{Date}]"> <p style="width:96%:height:100%;background-color:[{hdcolor}];color:white;font-size:40px;padding-left:5%;visibility:[{vHidden}]"><b>[{vDay}] </b></p>

</td></a>[{JumpDown}]

.footer

</tr>

</table>

.end

</div>

</div>

………………………

Here you see very clearly the combination of DFD DQl and HTML, and also very visually show the strength of the solution.

I use Bootstrap framework for visual components, so the classing is basically to tell the “widget” how to look, then I dynamically generate the HTML with a traditional DFD approach.

Header
Body
footer


Where I Put the table header stuff in header, rows in itmes and footer in footer….

Could it be simpler?

Imagine when we break the WebObject/PRISM barrier and you will be able to trigger DFW actions and store data in tables from the WebObject in DE8….

Than the sky is the limit for WebForms in DE8.

Written by DataEase 21/10/15 at 08:46:54 Dataease [{8}]FIVE