Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: formatting a Date geted from a Database access
PostPosted: October 27th, 2008, 8:57 am 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
Hi,
can someone help me?
i would to format a date taken from a access database to a format
ex: Day Month Year
because now he take me
1989-09-12 00:00:00

and i would
12-09-1989 or 12-settembre-89

if is possible set it to italian ?
thanks

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: formatting a Date geted from a Database access
PostPosted: October 30th, 2008, 10:53 am 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
Mikolson05 wrote:
Hi,
can someone help me?
i would to format a date taken from a access database to a format
ex: Day Month Year
because now he take me
1989-09-12 00:00:00

and i would
12-09-1989 or 12-settembre-89

if is possible set it to italian ?
thanks


up

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: No easy solution
PostPosted: October 30th, 2008, 9:25 pm 
Offline

Joined: October 25th, 2004, 2:20 pm
Posts: 686
Location: Naperville, Illinois (USA)
Opus: 7.05
OS: Win XP SP3
System: P4 3.2GHz 1GB RAM 2-TB HDs + 4 more
I've looked over your request several times. There is no EASY solution. You first must extract the data from the data base and place it into a variable (or preferable multiple variables) in OPUS. If you can break the pieces into separate variables during the "READ" portion of the project, that would be helpful, otherwise you will need Scripting to read the numeric data and create separate variables for the year, day, and month.

OPUS has Select and Case under Actions -> Programming. You would insert your month variable in the Select statement, then create a Case for each month. For example, when the Case is equal to "1" you would give another variable a value of "Jan" or "January" or whatever it would be in Italian. You have to create all 12 possible months, plus I'd have something in case there is no month data, or if the value is greater than 12.

Use a Frame with an "On Show" Trigger to read the data base, break apart all the data into separate variables, then assign alpha characters to a numeric value. Finally, you take each of the number variables and alpha characters and place them within a Text Object in the format you desire.

_________________
Fred Harms, Extraordinary Demos
Naperville, Illinois (USA) 630/904-3636
demofred@aol.com


For this message demofred has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: thanks Demo
PostPosted: October 30th, 2008, 10:18 pm 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
...but can you make an axample for this?
so, how i can separate the data, on the database the format of the data is
13/12/1958

how can i separate this on 3 variables?

thanks

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: October 30th, 2008, 11:17 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Use this:


//CREATE AN ARRAY CONTAINING MONTH STRINGS
myCal = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec')



//EXAMPLE OF USE
accessDate = "2008-10-30-00-00-00"
Debug.trace(formatDate(accessDate))
//END OF EXAMPLE



//FUNCTION THAT EXTRACTS SUBSTRINGS FROM PASSED DATE AND CONVERTS MONTH TO STRING

function formatDate(x)
{
return x.substring(8,10)+'-'+ myCal[parseInt(x.substring(5,7)-1)] +'-'+ x.substring(0,4)


if you are pulling data in via opus actions, wrap the variables in the function else you can simply call the function in your scripts.

The English can be changed to whatever language you like.

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: thanks mackavi
PostPosted: October 31st, 2008, 11:25 pm 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
can you upload an example maked with opus please?

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 1st, 2008, 1:24 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Paste Mack's script into a script object and hit F5 to see it working.

Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: thanks Demo
PostPosted: November 1st, 2008, 1:51 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Mikolson05 wrote:
how i can separate the data, on the database the format of the data is 13/12/1958

how can i separate this on 3 variables?

thanks


see attached example, I'm using the split function.


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject: great paul
PostPosted: November 1st, 2008, 7:17 pm 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
but how i can delete this final numbers? (in red)
1989-09-12 00:00:00

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 1st, 2008, 8:15 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Use split twice -- the first time to split on the spaces " "
Then split the first part (firstSplit[0]) using "-"

// script #################################

foo = "1989-09-12 00:00:00"

firstSplit = foo.split(" ");
secondSplit = firstSplit[0].split("-");

v1 = secondSplit[0];
v2 = secondSplit[1];
v3 = secondSplit[2];

// ####################################

Explanation::
The first split will separate the date string at the first space, leaving "1989-09-12" in the array element firstSplit[0].
You can ignore the rest of the array as it contains the unwanted part "00:00:00".
Now split the array element "firstSplit[0]" into a second array using "-" to make the final separation into the three variables required.

Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject: thanks
PostPosted: November 1st, 2008, 9:58 pm 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
that's all right,
now it's possible to create a imput mask for date?
example

21/08/1980

__/__/____

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 1st, 2008, 10:26 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
It would be easy if Opus had Regular Expressions.
Unless you can guarantee that the date is always entered exactly in the format DD/MM/YYYY it won't be easy.
The easiest way around the problem would be to use three input boxes and limit the length of input accordingly.

Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: November 1st, 2008, 11:05 pm 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
paul wrote:
It would be easy if Opus had Regular Expressions.
Unless you can guarantee that the date is always entered exactly in the format DD/MM/YYYY it won't be easy.
The easiest way around the problem would be to use three input boxes and limit the length of input accordingly.

Paul


well, thanks

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 2nd, 2008, 11:16 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
RegExp would be a great addition to Opus Script!

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 : lmc


Top
 Profile Visit website  
 
 Post subject: ok, but
PostPosted: November 4th, 2008, 9:03 am 
Offline

Joined: May 20th, 2006, 4:53 pm
Posts: 43
Location: Italy
Opus: Opus Pro 7.01
OS: Windows 7
paul wrote:
It would be easy if Opus had Regular Expressions.
Unless you can guarantee that the date is always entered exactly in the format DD/MM/YYYY it won't be easy.
The easiest way around the problem would be to use three input boxes and limit the length of input accordingly.

Paul


ok but how i can store onto database the 3 imput of relative day,mounth,year?

_________________
Software: Opus v7.01
OS: Windows 7 64 bit
Hardware: In progress


For this message Mikolson05 has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 32 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