HyperNext Studio
HyperNext Studio => General => Topic started by: scottbux on August 03, 2011, 01:16:39 AM
-
im trying to import data from excel. i have no idea how to do it. i have read through the entire quick start guide and searched through all the forums but i cant find anything. the closest thing to an answer i have found says to check out the books project. but from what i understand that just saves data you type into the software. here is an example of what i need.
Phone Number Customer Name Account Info
"Data from cell A" "Data from cell B" "Data from cell C"
Notes: "whatever notes the employee writes"
Then i need to know how to save data (like data put into the notes field) into a different excel file. i pretty much have the rest of the software made i just need this very important detail. i have never programmed any kind of software before so all of this is new to me. so please explain it like you're talking to a 7 year old :)
oh and one more thing. i need to know how to password protect my software. so new users would have to enter their own custom username and password. Please help!
Scott
-
im trying to import data from excel. i have no idea how to do it. i have read through the entire quick start guide and searched through all the forums but i cant find anything. the closest thing to an answer i have found says to check out the books project. but from what i understand that just saves data you type into the software. here is an example of what i need.
Phone Number Customer Name Account Info
"Data from cell A" "Data from cell B" "Data from cell C"
Notes: "whatever notes the employee writes"
Then i need to know how to save data (like data put into the notes field) into a different excel file. i pretty much have the rest of the software made i just need this very important detail. i have never programmed any kind of software before so all of this is new to me. so please explain it like you're talking to a 7 year old :)
Sorry, I'm so tired I feel like a 5 year old :)
Your Excel needs saving in CSV format - and as a basic Excel file, not with Workbook.
Here is some code that would readin data from an Excel file and place it in a field so its format could be examined - it is from this post:-
http://www.tigabyte.com/smf/index.php?topic=91.msg324#msg324 (http://www.tigabyte.com/smf/index.php?topic=91.msg324#msg324)
@Read from a named file, assumes format known
Local fname,fvar,fdets,ftypes,fpaths,fnames,fextens
Local findex,fend
local comma,mess
@ delimiter
Put ',' into comma
@ File name
Put 'comicbook1.csv' into fname
FileGet(fname,fvar,fdets,ftypes,fpaths,fnames,fextens)
OpenAsBFile(fvar,findex)
@ ++ loop over file until no data remaining +++
Put EndBFileFN(findex) into fend
While (fend<>1)
ReadBVariable(findex,mess)
if mess$<>comma then
Put mess after field 2
EndIf
Put EndBFileFN(findex) into fend
EndWhile
CloseBFile(findex)
About saving your data to an Excel file - i'm not sure how to get the exact layout you require in terms of cell placement.
Here is a post with some code for saving to a CSV format:-
http://www.tigabyte.com/smf/index.php?topic=14.msg281#msg281 (http://www.tigabyte.com/smf/index.php?topic=14.msg281#msg281)
and here is the relevant code from that post:-
@ Write to a named file
Local fname,fvar,fdets,ftypes,fpaths,fnames,fextens
Local findex,n
Local comma,char
@ delimiter
Put ',' into comma
@ File name
Put 'test1.csv' into fname
@ Create and open file
FileGet(fname,fvar,fdets,ftypes,fpaths,fnames,fextens)
CreateBFile(fvar,findex,n)
@ Write data to file
WriteBVariable(findex,'hello')
WriteBVariable(findex,comma)
WriteBVariable(findex,'how are you')
WriteBVariable(findex,comma)
WriteBVariable(findex,'today')
@ Close file
CloseBFile(findex)
oh and one more thing. i need to know how to password protect my software. so new users would have to enter their own custom username and password. Please help!
Yes you can password to prevent unauthorised users looking at other cards and info. Here is one post on it:-
http://www.tigabyte.com/smf/index.php?topic=82.msg246#msg246 (http://www.tigabyte.com/smf/index.php?topic=82.msg246#msg246)
On your home card or another suitable card put one button and two fields where field 1 holds the name and field 2 holds the password. Place this code in the login button
Local name,password
Put field 1 into name
Put field 2 into password
If (name$=’John Smith’) and (password$=’1234’) then
GotoCard 2
else
Message ‘Invalid”
Endif
In a working program you would store the names and passwords in a list using “Put after”. Here is some code (not tested) that shows the basic idea for seeing if a name and password is in the lists. Place this code in the login button
Global nameList,passwordList
Local name1,password1,name2,password2,n,count
Put field 1 into name1
Put field 2 into password1
Put LinesFN(namesList) into count
if count>0 then
for n=1 to count
put line n of nameList into name2
if name2$=name1 then
put line n of passwordList into password2
if (password2$=password1) then
GotoCard 2
endif
Endif
endfor
EndIf
Message ‘Invalid attempt’
Malkom
-
wow thanks for the quick response. so....nothing worked. i copied the first code you gave me and switched out the file name "comicbook1.csv" to the one im using. it just copies all of the data into one field (name, phone number ect.) so how do i make it transfer the data from specific cells to specific fields?
i also tried the password code you gave me but to no avail. i copied and pasted the code to the sign in button, but when i push "Run" the Compile screen and little Cards progress bar come up and the green progress bar gets about a fifth of the way there and just stops. ive tried just waiting it out (like 15 minutes) but no progress. so i figured i should try uninstalling hypernext and reinstalling but the same thing still happens. any ideas?
i havent tried using the save to csv code you gave me yet. i figure i'll cross that bridge after i can imput data first.
thanks,
Scott