Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 9:13 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Date/Time display in Opus pulled from MS Access
PostPosted: July 23rd, 2012, 3:13 am 
Offline
User avatar

Joined: November 4th, 2004, 5:04 pm
Posts: 310
Location: New Zealand
Opus: Evolution 8.5
OS: Windows 7 Professional
System: AMD Phenom(tm) II X6 1055T Processor 2.80GHz
Hi there,
Tearing my hair out again with Access.
I have a pub that is pulling information from an Access database and displaying on a page,
but the Date/Time information (even though it looks correct in the Access table e.g 10/06/2001) is being displayed 2001-06-10 00:00:00
Does anyone know of a fix???
Really appreciate some advice

Also - there seems to be a problem with moving objects on a page since the update to v 8.02??
I can move objects with the keyboard arrows - but the move tool - although it selects - will not allow me to move???

Regards

Pete

_________________
Opus Evolution Pro user
Windows 7 Professional
http://www.petesmithiesmedia.com


For this message Pete Smithies has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 23rd, 2012, 8:16 am 
Offline
User avatar

Joined: November 4th, 2004, 5:04 pm
Posts: 310
Location: New Zealand
Opus: Evolution 8.5
OS: Windows 7 Professional
System: AMD Phenom(tm) II X6 1055T Processor 2.80GHz
I have emailed DW regarding the object moving with the selection tool problem, but just wanted to ask if others have had any problems since the update??
Pete

_________________
Opus Evolution Pro user
Windows 7 Professional
http://www.petesmithiesmedia.com


For this message Pete Smithies has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 24th, 2012, 8:36 pm 
Offline
User avatar

Joined: November 4th, 2004, 5:04 pm
Posts: 310
Location: New Zealand
Opus: Evolution 8.5
OS: Windows 7 Professional
System: AMD Phenom(tm) II X6 1055T Processor 2.80GHz
The mouse problem has been resolved - it was not an Opus issue.
But if anyone has any ideas how I can resolve the way the date is being displayed (and strip out the time) I would be really grateful.
Thanks
Pete

_________________
Opus Evolution Pro user
Windows 7 Professional
http://www.petesmithiesmedia.com


For this message Pete Smithies has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 24th, 2012, 10:14 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Hi Pete,
I'm assuming that Access can't give out the required format.
you can reformat the date with a few string functions. I've put a function together that will work on this particular input.
Method::
You use substring(0,10) to extract the first 10 characters in the string, removing the time from the string.
Split the remaining string apart between the "-".
Reassemble by adding the separate elements in the required order along with the forward slashes required.
Drop the script below into a script object and you will see it working.

// example of usage

inString = "2001-06-10 00:00:00";

function strChange(inStr)
{
mySub = inStr.substring(0,10)
arr = mySub.split("-");
newStr = arr[1] +"/" + arr[2] +"/"+ arr[0];
return newStr;
}

outString = strChange(inString);

Debug.trace(outString);

// script end

cheers
Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 25th, 2012, 7:22 am 
Offline
User avatar

Joined: November 4th, 2004, 5:04 pm
Posts: 310
Location: New Zealand
Opus: Evolution 8.5
OS: Windows 7 Professional
System: AMD Phenom(tm) II X6 1055T Processor 2.80GHz
Hi Paul,

Many thanks for your reply.
Quick (are they ever) question
I think I understand your solution - many thanks you are a star as always, - but the string that I want to be reworked is actually a VARIABLE
called <DOD> so would the code be like this:


inString = "<DOD>";

function strChange(inStr)
{
mySub = inStr.substring(0,10)
arr = mySub.split("-");
newStr = arr[1] +"/" + arr[2] +"/"+ arr[0];
return newStr;
}

outString = strChange(inString);

Debug.trace(outString);

_________________
Opus Evolution Pro user
Windows 7 Professional
http://www.petesmithiesmedia.com


For this message Pete Smithies has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 25th, 2012, 9:03 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
No. Anything in speech marks will be treated literally.

Simply pass the function your variable - no speech - no brackets.

Code:
strChange(DOD)


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 25th, 2012, 10:42 pm 
Offline
User avatar

Joined: November 4th, 2004, 5:04 pm
Posts: 310
Location: New Zealand
Opus: Evolution 8.5
OS: Windows 7 Professional
System: AMD Phenom(tm) II X6 1055T Processor 2.80GHz
Hi Mack

Sorry - still not quite getting this

Can you tell me what needs to go after

inString = ??????? ;

function strChange(DOD)
{
mySub = inStr.substring(0,10)
arr = mySub.split("-");
newStr = arr[1] +"/" + arr[2] +"/"+ arr[0];
return newStr;
}

outString = strChange(inString);

Debug.trace(outString);


Thanks
Pete

_________________
Opus Evolution Pro user
Windows 7 Professional
http://www.petesmithiesmedia.com


For this message Pete Smithies has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 25th, 2012, 11:12 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Not quite ;-)

Code:
function strChange(inStr)
{
mySub = inStr.substring(0,10)
arr = mySub.split("-");
newStr = arr[1] +"/" + arr[2] +"/"+ arr[0];
return newStr;
}

outString = strChange(DOD); //*1 see note below.

Debug.trace(outString);



*1 You don't need to set the value for inString as per the original example because it's already stored in the DOD variable.

You 'pass' a value to a function by calling the function's name (IE strChange) and including the value (number, string, array or variable) in the brackets after the function name. The actual 'function' as defined by the keyword FUNCTION receives the value into one of its parameters (IE inStr). For example:

Code:
function iAmADemo(a,b,c)
{
Debug.trace(a+b+c)
}


The function above accepts three parameters - a, b and c. To use this function we call the function by its name and pass the values we wish to use. EG

Code:
myAnswer = iAmADemo(3,7,14)


In your case, rather than pass a literal value, you pass a variable storing the literal value.

Code:
var sum_of_orders = 3;
var total_number_of_purchases = 7;
var amount_of_vat = 14;

myAnswer = iAmADemo(sum_of_orders,total_number_of_purchases,amount_of_vat)


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 25th, 2012, 11:51 pm 
Offline
User avatar

Joined: November 4th, 2004, 5:04 pm
Posts: 310
Location: New Zealand
Opus: Evolution 8.5
OS: Windows 7 Professional
System: AMD Phenom(tm) II X6 1055T Processor 2.80GHz
Hi Mack,

That new code works in terms of displaying the correct date in the debug trace window.
Albeit I had to switch the arr to 2 then 1 and then 0.

SO thank you very much.

However the variable on the page is still showing 1942-10-24 00:00:00

I have this code as a script object on the page
How do I get the new date to show in the DOD variable textbox?

Regards

Pete

_________________
Opus Evolution Pro user
Windows 7 Professional
http://www.petesmithiesmedia.com


For this message Pete Smithies has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 26th, 2012, 6:10 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Just assign it back to the original variable:

Code:
DOD = strChange(DOD)


instead of

Code:
outString = strChange(DOD)


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : Pete Smithies


Top
 Profile Visit website  
 
 Post subject: Re: Date/Time display in Opus pulled from MS Access
PostPosted: July 26th, 2012, 10:47 pm 
Offline
User avatar

Joined: November 4th, 2004, 5:04 pm
Posts: 310
Location: New Zealand
Opus: Evolution 8.5
OS: Windows 7 Professional
System: AMD Phenom(tm) II X6 1055T Processor 2.80GHz
Thanks Mack that worked a treat.
I am now looking at your Functions imp (thanks for the correct link) in the hope of being able to ascertain how to populate an array list from an Access Database.

Thanks again
I would like to say I wont bother you again - but I dare say that simply isn't true!!

Warm regards

Pete

_________________
Opus Evolution Pro user
Windows 7 Professional
http://www.petesmithiesmedia.com


For this message Pete Smithies has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 39 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group