Tengel
Posts: 49
|
| Posted: 11/16/2004, 3:56 PM |
|
I'm trying to get the value from grid into a txt, in this cache called awm, this grid gives ID and text, my problem is that my custom code only write last ID and text. So I hope someone can tell me what to do, so it write all the ID/text the grid shows
My Code:
// Write your own code here.
$id = $awm->id->GetValue();
$text = $awm->text->GetValue();
$print = $id." ".$text;
$fp = fopen("file.txt", "w");
fwrite($fp, $print);
fclose($fp);
_________________
---
Tengel |
 |
 |
peterr
Posts: 5971
|
| Posted: 11/16/2004, 3:59 PM |
|
Which event are you using for this?
It probably should be the "Before Show Row" event.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Tengel
Posts: 49
|
| Posted: 11/16/2004, 4:03 PM |
|
Correct, it is Before Show, it does work, but only return last ID/txt value
_________________
---
Tengel |
 |
 |
peterr
Posts: 5971
|
| Posted: 11/16/2004, 4:08 PM |
|
What do you mean "correct"? I just wrote that it should be "Before Show Row", not "Before Show" - so that's the problem...
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Tengel
Posts: 49
|
| Posted: 11/16/2004, 4:08 PM |
|
To be more spesific, Grid: awm Server--Before Show-Cutome Code
_________________
---
Tengel |
 |
 |
Tengel
Posts: 49
|
| Posted: 11/16/2004, 4:09 PM |
|
ahh, ok, will try that :)
_________________
---
Tengel |
 |
 |
Tengel
Posts: 49
|
| Posted: 11/16/2004, 4:17 PM |
|
Did not work, same results
//awm_BeforeShowRow @140-C2809E4A
function awm_BeforeShowRow()
{
$awm_BeforeShowRow = true;
//End awm_BeforeShowRow
//Custom Code @824-D713EC2E
// -------------------------
global $awm;
$id = $awm->id->GetValue();
$text = $awm->text->GetValue();
$print = $id." ".$text;
$fp = fopen("file.txt", "w");
fwrite($fp, $print);
fclose($fp);
// -------------------------
_________________
---
Tengel |
 |
 |
peterr
Posts: 5971
|
| Posted: 11/16/2004, 4:26 PM |
|
http://us2.php.net/fopen
Quote :'w' = Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
So, you are overwriting your file each time.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Tengel
Posts: 49
|
| Posted: 11/16/2004, 4:50 PM |
|
ohh, I did't think of that because I have a another statment where this work, but change it to a+ did the work, thanks alot peterr.
_________________
---
Tengel |
 |
 |
|