sbrinley
-
Posts
21 -
Joined
-
Last visited
Never
Posts posted by sbrinley
-
-
I'm trying to take a block of text that is formatted very poorly and put it into something that is more database friendly. Here is an example of the text:
---------------------------------------------------------------------------------------------------------------------------------- Albert, Kyle 050359 92501 Temp sunshade ID IN Dept ACTIVITY OUT ID IN Dept ACTIVITY OUT TOTALS Mon 01/04 553a 611p 12.00 12.00 Tue 01/05 552a 603p 12.00 24.00 Wed 01/06 558a 647p*L 12.00 36.00 Thu 01/07 632a*L 909a*E 2.60 38.60 Acct:92501 TempRg: 38.60 ---------------------------------------------------------------------------------------------------------------------------------- Aldridge,Jennie M 0001090916 026991 Plt 2 Shipping ID IN Dept ACTIVITY OUT ID IN Dept ACTIVITY OUT TOTALS Mon 01/04 538a 431p 10.00 10.00 Tue 01/05 541a 431p 10.00 20.00 Wed 01/06 541a 448p 10.00 30.00 Thu 01/07 547a 5.00 35.00 Acct:026991 REG: 35.00 ----------------------------------------------------------------------------------------------------------------------------------
The goal is to get it to look something like this:
Name ID Workcenter Date hrs worked
Albert, Kyle 050359 92501 01/04/10 12
Albert, Kyle 050359 92501 01/05/10 12
Albert, Kyle 050359 92501 01/06/10 12
Albert, Kyle 050359 92501 01/07/10 2
Aldridge,Jennie 0001090916 026991 01/04/10 10
Aldridge,Jennie 0001090916 026991 01/05/10 10
Aldridge,Jennie 0001090916 026991 01/06/10 10
Aldridge,Jennie 0001090916 026991 01/07/10 5
The data will always be in the same place in the file. I'm not even sure what method would work to go through the the file to make this happen.
I'm not exactly looking for a complete answer but more of a nudge in the right direction.
-
I'm having a bit of trouble working with dates and the AS400. I'm writing a program with PHP that will allow users to see a customer requirements schedule based on different selections such as price, qty, labor, etc... Part of this program uses the week number (since users will select their date range based on weeks)
My issue is this the current date format in field I'm using is 20100114 or YYYYMMDD which is stored as a numeric value and from this I would like to pull what week of the year it is.
If I simply try using WEEK($DATA) where the $data is my actual column name, it won't work. The only way I've gotten this to work is by using the strsql command on the AS400 itself and converting the date with the following command:
WEEK(DATE(CONCAT(CONCAT(CONCAT(CONCAT(SUBSTR(DIGITS(LSDTE),5,2),'/'),SUBSTR(DIGITS(LSDTE),7,2)),'/'),SUBSTR(DIGITS(LSDTE),3,2))))
(the reason for so many concatenations is I can't concat more than 2 items at a time because of whatever reason on the AS400)
However when I try to do this with the ODBC connection in PHP it simply laughs at me.
This is the SQL I'm using in the PHP script that I'm simply testing with:
$SQL = "select LPROD, LQORD, LQSHP, LSDTE, WEEK(DATE(CONCAT(CONCAT(CONCAT(CONCAT(SUBSTR(DIGITS(LSDTE),5,2),'/'),SUBSTR(DIGITS(LSDTE),7,2)),'/'),SUBSTR(DIGITS(LSDTE),3,2)))) FROM BPCS405CDF.ECL where LID = 'CL' and LPROD = 'D61120104GAT'";
This query returns all the values except the week number even though it returns the value on the AS400.
So the answers I'm looking for are:
- When you use a ODBC connection what is the SQL based on? In this case the AS400 or PHP's ODBC stuff?
- If it is the AS400 any ideas why this won't work?Or evne a possible alternate solution
An alternate solution I can think of is creating a table that simply has the date and the conversation date along with the week and week day. However that is not a very reliable way and I would not like to do that if possible.
- When you use a ODBC connection what is the SQL based on? In this case the AS400 or PHP's ODBC stuff?
-
Hi
Probably something like this:-
<?php function display_children($parent) { // retrieve all children of $parent $result = mysql_query('SELECT child FROM bom WHERE parent="'.$parent.'";'); // display each child $FirstTime = true; while ($row = mysql_fetch_array($result)) { if ($FirstTime) { echo "<ul>"; $FirstTime = false; } // indent and display the title of this child echo "<li>".$row['child']."</li>"; // call this function again to display this // child's children display_children($row['child']); } if (!$FirstTime) echo "</ul>"; } display_children(''); ?>
You are awesome that's exactly what I'm looking for!
Also thanks roopurt18 that is very helpful as well. i'll do some checking into that.
-
Whether its using   or html tags I still need some help adding the tags to the loop.
-
Thanks for the replies. I think more in lines of what I meant about the spacing is to create <ul> items. I put in the spaces as just an example.
Here is what I'm talking about:
<ul>A00320002AXA <li><ul>R50210002AXA</li> <li>R50210002AXX</li></ul> <li><ul>R50230302AXA</li> <li><ul>R50230002AXA</li> <li>R50230002AXX</li></ul></ul> <li><ul>R50240302AXA</li> <li>R50240002AXA</li></ul> </ul>
I'm wondering how to insert the unordered list item tags into the loop.
-
About a week ago I posted something similar but I don't think I asked the question correctly. I've come very close to a solution but I need a little help to get the rest of the way (or maybe a different set of eyes)
This is what I have so far:
A table that looks like this:
Parent Child A00030002AXA A00030002AXA R50210802AXA A00030002AXA R50231502AXA A00030002AXA R50241502AXA R50210802AXA R50210002AXA R50231502AXA R50230002AXA R50241502AXA R50240002AXA
This is the PHP script I'm using. Which has been modified by search through various other solutions and take in part from a tutorial from another website.
function display_children($parent, $level) { // retrieve all children of $parent $result = mysql_query('SELECT child FROM bom '. 'WHERE parent="'.$parent.'";'); // display each child while ($row = mysql_fetch_array($result)) { // indent and display the title of this child echo str_repeat(' ',$level).$row['child']."<br>"; // call this function again to display this // child's children display_children($row['child'], $level+1); } } display_children('',0);
What is displayed is this
A00320002AXA R50210002AXA R50210002AXX R50230302AXA R50230002AXA R50230002AXX R50240302AXA R50240002AXA R50240002AXX
I would like to arrange the data so it looks like this
A00320002AXA R50210002AXA R50210002AXX R50230302AXA R50230002AXA R50230002AXX R50240302AXA R50240002AXA
Does anyone have any suggestions or can you point me in the right direction? Thanks !!!
-
I am trying to take a list of data with two columns and separate it out into a structured table. Here is a sample list of the data
Parent Child
D61120901GAT R61120901GAT
R61120901GAT R61120801GAT
R61120801GAT R61120801GAA
R61120801GAA R61120701GAT
R61120701GAT R61120601GAT
R61120601GAT R61120501GAT
R61120501GAT R61120003GAT
This is the list I want to turn into this
D61120901GAT
R61120901GAT
R61120801GAT
R61120801GAA
R61120701GAT
R61120601GAT
R61120501GAT
R61120003GAT
The parent might have up to 10 children deep in total. Also the parent might have two or more direct children.
for example:
D61120901GAT
R61120901GAT
R61120801GAT
R61121901GAT
R61121801GAT
Also even though the numbers seem to go into order here they don't in every part. A typical list size is about 20k lines long.
I've tried a few different while loops without success. I fear I might be over complicating it or not looping correctly. If anyone has some ideas or a solutions I would appreciate it!
-
There's not a problem if you go through windows explorer but it you go through internet explorer or firefox (which is what my users use) then it doesn't work.
Also there's the slight issue of providing the full path instead of the c:/fakepath that populates.
I did a calculation and all the files that would be uploaded total less then 1GB and I can't imagine even in the future going over 2GB so it should be that big of an issue. The users won't know the difference and the only real issue with going that way is inconsistency of data. If people don't update the file on the internal website as well as the local files then there could be issues.
-
I decided to move on to the next part of the project assuming I could get this to work which is linking the files to a path. It seems IE7, IE8 and firefox have local access links disabled.
I have found a few solutions to enable them but this opens a huge security risk and is somewhat time consuming.
I'm going to mark this question as solved since there isn't a solution / even if this works it can't go anywhere.
Thanks for your help.
-
I decided to move on to the next part of the project assuming I could get this to work which is linking the files to a path. It seems IE7, IE8 and firefox have local access links disabled.
I have found a few solutions to enable them but this opens a huge security risk and is somewhat time consuming.
I'm going to mark this question as solved since there isn't a solution / even if this works it can't go anywhere.
Thanks for your help.
-
Here's a little update on what I've found so far
This code
<form>
<textarea name='abc' rows=30 cols=50></textarea>
<input type=file onchange="this.form.abc.value+=';' + this.value; return
true;" multiple>
</form>
In firefox 3 I will get the name of the file just like the $_FILES however with IE8 I get this on the left side
;C:\fakepath\SNC00102.jpg
here's a screen shot.
The actually path of the file selected is c:\downloads\SNC00102.jpg as you can see from the screen shot...
-
that is true but if you look at the global variable $_FILES it will only show the file name not the actual path.
On a side note I've done some more digging and found that with this
<form>
<textarea name='abc' rows=30 cols=50></textarea>
<input type=file onchange="this.form.abc.value+=';' + this.value; return
true;" multiple>
</form>
In firefox 3 I will get the name of the file just like the $_FILES however with IE8 I get this on the left side
;C:\fakepath\SNC00102.jpg
here's a screen shot.
The actually path of the file selected is c:\downloads\SNC00102.jpg as you can see from the screen shot...
-
Correct I posted here:
* PHP Freaks Forums > Client Side > JavaScript Help
Here is the link if anyone is interested.
http://www.phpfreaks.com/forums/index.php/topic,252214.0.html
-
Thanks for the help I appreciate you looking at this. None the less I've submitted the same question in the Java section maybe someone might have an idea. If I happen to find a solution I'll be sure to post in case someone else is looking for something similar.
-
How can I allow the user to use a browser interface like the html form upload browse to allow the user to select a file to get the local path (actually a mapped network drive on a corporate file server)
Here is an example:
User A wants to link the company org chart to everyone. They log onto the internal internet page, choose the file at this location for example z:/hr/orgchart.ppt by browsing, they submit the file.
User B goes to the page and clicks the link to view. instead of going to a directory on the web server as if someone uploaded the file they are pointed to z:/hr/orgchart.ppt
The point of this is to eliminate users from putting files on both the file server and web server.
Maybe I'm going about this in the wrong way but basically I just need users to select a path of a file by browsing then have that path posted as a link on a page.
This is a corp network. Users would be pointing files to a mapped network drive that is shared and security is provided by active directory.
User A might know where the file is located but they don't know the full path and or file extension on the file. My end goal is to allow users to link their own files instead of me manually linking them or changing links every time a file version changes or they wish to add more files. I also don't want to eat up space on a web server by having users upload files that already exist on the file server. (why way disk space or backup tape drive space)
I originally started out asking for help in PHP here is a link to the thread http://www.phpfreaks.com/forums/index.php/topic,251884.0.html. It seems I can't get the information through PHP so I'm hoping java can help.
p.s I'm a complete noob when it comes to java.
-
Yes sir you are completely correct.
However this is a corp network. Users would be pointing files to a mapped network drive that is shared and security is provided by active directory. PHP is simply providing the link to that directory or file.
User A might know where the file is located but they don't know the full path and or file extension on the file. My end goal is to allow users to link their own files instead of manually linking them or changing things every time a file version changes or they wish to add more files.
If PHP isn't a good solution do you happen to have an idea on what language to look? I though about java possibly but I have zero knowledge of java
-
True. However I don't actually want the users to upload the file I want the path of the file they are choosing.
The point is to allow the user to link files on a page in an internal network. An example would be:
User A wants to link the company org chart to everyone. They log onto the internal internet page, choose the file at this location for example z:/hr/orgchart.ppt by browsing, they submit the file.
User B goes to the page and clicks the link to view. instead of going to a directory on the web server as if someone uploaded the file they are pointed to z:/hr/orgchart.ppt
The point of this is to eliminate users from putting files on both the file server and web server.
Maybe I'm going about this in the wrong way but basically I just need users to select a path of a file by browsing then have that path posted as a link on a page.
-
How is that nothing? What are you looking for? Sorry if I didn't understand.
It's ok. Half the battle in any problem is asking the question the right way to get the answer. Sometimes I feel like I should have interpreter so people can understand me... anyways here's another try
Here is a sample upload screen
what I am looking for is when this form is submitted is a way to grab the path in the form. I want to take the C:\Downloads\test.txt or whatever the value happens to be and post it to a string so I can then use it later.
the goal is the user doesn't have to know the exact path they can use the browse button to find the file.
-
I think I have narrowed down what I'm exactly looking for.
If I can grab the users URI from the form posting. I tired looking at the posting array but nothing is shown except the following
Array ( [userfile] => Array ( [name] => SNC00003.JPG [type] => image/jpeg [tmp_name] => C:\WINDOWS\Temp\php97.tmp [error] => 0 => 97817 ) )
-
I'm in charge of building our company intranet system. In that system I'm trying to build a simple interface for site administrators to link file paths and names to the site without knowing the actual path of the file but to select the path in something similar like uploading a file through a HTML form. Also while doing this please assume these things:
- All files that will be linked will be hosted on the company file server.
- All shared server folders have standardized drive letters. For example the purchasing drive for all users would be P:
- a sample link path might be K:/HR/orgchart.ppt
- All permissions would be handled through Active Directory outside of PHP
- this site would be for internal use only. No one from the outside would be able to access the site unless through a VPN connection.
Basically all i need is a way for users to select a file through a file explorer or browser and store it as a variable(s). I can handle the rest form there.
If you need more information please let me know!!
If someone could help I would appreciate it!
- All files that will be linked will be hosted on the company file server.
Date / Week issues with AS400 DB2
in Other RDBMS and SQL dialects
Posted
For those of you that might need this information in the future I found out the following solutions:
I was not able to convert the string directly so what I did instead was create a new table that allowed me to quickly look up a BPCS date into a regular date or week number. After doing that I was able to make the script work very easily.
Also the answers to my 1 question is:
Question: When you use a ODBC connection what is the SQL based on? In this case the AS400 or PHP's ODBC stuff?
Answer: Yes it is the ODBC connection however the ODBC connection might have capabilities that are not supported by the connected database it is also limited by the database as well. in this case I could use most functions but not functions that had specific limitations such as the concat function in this case.
Lastly here is the completed code for the final project: