Trying to make DF work for what we need it for ... hardly an

A place for users and developers of the Xataface to discuss and receive support.

Postby GenTarkin » Fri Jun 08, 2007 12:43 pm

Here is what we are trying achieve. We have a script that goes into a site that grabs reports of information automatically every day and that script then shoots over the values it pulls into a mySQL database I have set up.
The database consists of 2 tables one for one part of the script that grabs a certain section of data from units and then another table that does the same thing.
So we have 2 tables with data in them. Within these tables both of them have a field that has a string value of the "unit number / description"

I have managed thus far to successfully install DF onto our server and it is interacting with the mySQL db perfectly and I even set up users and a read only account and admin account like you instructed how to do in the getting started guide.

The rest of the guide as far as relationships, delegation and the templating and stuff just...I look at the code and have no idea where to start.
Here is what I want to do with this.
The customer will be seeing DF in its READ ONLY permissions set up by their user account. So, they will not be doing any editing or adding of new records or anything like that, it is simply going to be used so they can parse units by their group ( unit number / description ) mentioned above. And also by a range of dates of collected data.
Here is what the idea so far has been: To somehow add a navigation menu to the left side that will contain buttons or a drop down list for a section ( the unit number / description - mentioned above in that field )
and also a date range calender icon of 2 calenders to select their range or 2 date drop down fields to select the date range. Submit a query based on that information and have it displayed properly in the right main pane.

Im guessing this can all probably be done similarly to how your demo of the bookstore is set up .. you have a navigation menu on the left that has the "categories" and then that shows up in the right accordingly.
If I could get that somehow with a date finder below those categories that would be what we are ultimately looking for.
If anyone could help me or tell me the easiest way to achieve what we want this thing to do that would be awesome. Like just point me in the direction of something like... well first you need to do this relationship and then this delegate control thingy here and then do this in the template... Just get me started and I would be greatful.
I do not know how hard or easy this is to do what I need it to do.
Thanks a ton for all willing to help =)
Jason
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jun 08, 2007 1:01 pm

Hi Jason,

It looks like you're on the right track.Ê Everything is pretty straight forward - except the calendar thing will probably require a little bit of javascript.
Using Dataface's url convention, you can probably get what you need by just creating links in a clever way.
For example you can search for date range with a url like:
http://yourdomain.com/yourapp/index.php?date=2004-09-18..2005-09-12
(to find records where the date field has a value between sept 18 2004 and sept 12 2005).
And as you know, you can make this all happen by creating a form:


Enter a title: Ê
etc...
The only tricky part will be the date fields.Ê You ultimately need to have a single form field that contains the input for the date field (e.g. startdate..enddate).
One way to achieve this is to have a hidden form field with the same name as your date field on which you are searching.Ê Then have 2 separate calendar widgets to select the start and end date.Ê And with an onsubmit() javascript handler for the form, you could enter the appropriate value into the hidden date field when the form is submitted.
For the calendar widgets you have an array of choices out there that you can use.Ê Dataface comes with one called JSCalendar (in the dataface/lib directory).Ê You can find more information about JS Calendar at http://www.dynarch.com/projects/calendar/
Yahoo also makes a number of nice DHTML widgets, including a calendar widget.Ê You can see more information about that one at http://developer.yahoo.com/yui/calendar/
Hope this helps you out a little..
Best regards
Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Fri Jun 08, 2007 3:27 pm

ok awesome, I have then one question for you, The date / time format that the script from the server we are pulling the data from is now pulled in the format of 00/00/0000 00:00:00 MST which is I noticed not how the DATE field in mySQL stores that information. How do I make the date we are pulling compatible with a DATE field type in mySQL? also what would be the best field for the dates would it be DATE or another field you recommend?
They will only need to query using the date as the time does not matter.
Thanks,
Jason
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Jun 11, 2007 9:00 am

You are able to adjust these values with jscalendar.ÊÊ I don't have the specifics at my fingertips, but a good way to find this information is to just look at the HTML source for an edit record form that uses the calendar and see how it is done there (if you are outputing directly from javascript).ÊÊ If you are using PHP to generate the source for it, then you can check out the HTML/QuickForm/calendar.php file in the dataface distribution to see how dataface does it.

Let me know if you have trouble finding it.
-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Tue Jun 12, 2007 12:01 pm

ok another question, Im trying to use javascript like you suggest to handle certain parts of my form, but... the { } brackets, for IF statements in javascript, are seen as comments or something inside the dataface_application_menu.html and Im getting all sort of parsing errors because its not kicking in the javascript....how do I get aroud this?
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Tue Jun 12, 2007 12:03 pm

OH and question how to submit a search query that can basically do OR searches like if it contains THIS or THIS or THIS show all 3 of them.
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Tue Jun 12, 2007 12:11 pm

Also, sorry for the many replies but I keep having questions come from me, is there any way to display all the data in the list view from both tables at the same time? what can I use in my GET statement that would show both tables contents at same time on same list.
Thanks
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Jun 12, 2007 12:46 pm

the { } brackets, for IF statements in javascript, are seen as comments
or something inside the dataface_application_menu.html and Im getting
all sort of parsing errors

Wrap your javascript in {literal} ... {/literal} tags.

e.g.

{literal}


{/literal}



OH and question how to submit a search query that can basically do OR
searches like if it contains THIS or THIS or THIS show all 3 of them.

Value 1 OR Value 2 OR Value 3

e.g. If you wanted to search for a person named Peter or Paul or John, you would type: "Peter OR Paul OR John" in the search field.

is there any way to display all the data in the list view from both tables at the same time

Yes.Ê The way to do it will depend on what exactly you mean by displaying both tables at the same time.Ê You could display two tables one on top of the other, in which case we don't worry about how the data in the tables are related. Or you could display a combined table where each row has columns from both tables (i.e. a JOIN table).Ê Which of these ways did you have in mind?

-Steve

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Thu Jun 14, 2007 9:49 am

ok I need help, I have the javascript successfully changing the value of a hidden field to correctly do DATESTART..DATESTOP into that hidden form element for the GET query. BUT, I need to also write javscript that will basically take out the .. in the query if the person does not enter any dates to the 2 fields.
So, here is the code I have so far, Im sure the syntax is just screwed up...if you could help me with it that would be awesome =)

{literal}


{/literal}
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Thu Jun 14, 2007 9:50 am

ok I need help, I have the javascript successfully changing the value of a hidden field to correctly do DATESTART..DATESTOP into that hidden form element for the GET query. BUT, I need to also write javscript that will basically take out the .. in the query if the person does not enter any dates to the 2 fields.

So, here is the code I have so far, Im sure the syntax is just screwed up...if you could help me with it that would be awesome =)

hrm it wouldnt let me put the code in =(



form Name="form1" action="index.php" method="get"
onsubmit="form1.call_data_time.value = form1.datestart.value + '..' + form1.datestop.value;
if(form1.call_date_time.value == ".."){ form1.call_data_time.value = "";
}else{
form1.call_data_time.value = form1.datestart.value + '..' + form1.datestop.value;
}">
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Thu Jun 14, 2007 9:50 am

ok there we go except with the correct < on the front =) and literals surrounding that entire block of code.
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu Jun 14, 2007 10:25 am

Looks good, except your order is a little off.Ê You probably want to do the check for '..' after you have placed the values in.

e.g.

form1.call_data_time.value = form1.datestart.value + '..' + form1.datestop.value;
if(form1.call_date_time.value == ".."){ form1.call_data_time.value = "";
}

I also notice that there is probably a typo somewhere here, because you are using 'call_date_time' in some places and 'call_data_time' in other places.Ê (note the difference between date and data).


-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Thu Jun 14, 2007 11:01 am

hrm...I just did notice that typo I fixed it to data thats what its supposed to be but.... its still not working right no matter what I type into query it always is setting the value of call_data_time to nothing.
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby GenTarkin » Thu Jun 14, 2007 11:13 am

sweet figured it out =)
onsubmit="form1.call_data_time.value = form1.datestart.value + '..' +
form1.datestop.value;
if(form1.call_data_time.value == '..'){ form1.call_data_time.value = '';
}"



cant use "" in the IF statement have to use '' =)

ok next question...when I say put in a range of dates from 05/25/2007..06/06/2007
It will only show an actual query of dates from 05/25/2007 to 06/05/2007

Is there any way to make it with your engine to tell it to include all numbers typed in including the 06/06/2007 one in the query?
Cuz this will confuse the client lol.
GenTarkin
 
Posts: 25
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu Jun 14, 2007 11:13 am

One technique that I often use when debugging javascript is to add alert() statements to see what is stored in different variables along the way.. This will tell you where you are going wrong.

e.g. Check what values are in form1.datestart.value and form1.datestop.value:

alert(form1.datestart.value);

alert(form1.datestop.value);

and so on... this will lead you to the problem.

-Steve

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Next

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 33 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved