Welcome! Log In Create A New Profile

Advanced

Pointers to file item/variables

Posted by Paul Ziegler 
Paul Ziegler
Pointers to file item/variables
October 12, 2008 05:10PM
In my old design tool we called them pointers. I am not sure what you call them in WD. I want to call a procedure that changes the value of a file item/ and or variable.

The calling code:

//sChildDocTitle1 is text to assign to File Item
//Document_Title_Child.DocumentName1 is the file item I want to assign the text to

DocumentTitleChange(sChildDocTitle1,"Document_Title_Child.DocumentName1")

The procedure:

PROCEDURE DocumentTitleChange(TitleName,TitleField)

HReadFirst(Document_Title_Child) //Only one record in this file
IF LockDisplayRecord("Document_Title_Child") THEN
TitleField = TitleName //Title field is the file item and TitleName is the new value
HModify(Document_Title_Child)
HUnlockRecNum(Document_Title_Child)
END

This doesn't work for me. Any replies are appreciated.
I would also like to do this for variables.

Paul Ziegler
Private Advantage Software
Al
Re: Pointers to file item/variables
October 12, 2008 05:32PM
Hello Paul

Edit: I have deleted my answer because I misread the intent of your original post and my answer was not relevant

Regards
Al




Edited 1 time(s). Last edit at 10/12/2008 08:16PM by Al.
DW
Re: Pointers to file item/variables
October 12, 2008 06:01PM
Hello Paul

Pointers in Windev are "Indirection"

The help menu will explain them.
BLS
Re: Pointers to file item/variables
October 12, 2008 07:36PM
FUNCTION  ModifyHF( filemame is string = "CLIENT")

	 RESULT HModify ( {filemame, indFile } )  // the {} are your indirection operands

hth, Bjoern
*PS as always not verified... show your old system code. just a matter of interest, thanks





Edited 1 time(s). Last edit at 10/12/2008 07:38PM by BLS.
Paul Ziegler
Re: Pointers to file item/variables
October 13, 2008 03:16PM
Bjoern,

Thanks for the reply. The { } was what I needed. Works fine now.

Paul Ziegler
Paul Ziegler
Re: Pointers to file item/variables
October 14, 2008 12:46AM
Bjoern,

Old Design tool code:

'sChildDocTitle1 is text to assign to File Item
'Document_Title_Child.DocumentName1 is the file item I want to assign the text to

'Calling the procedure
DocumentTitleChange(sChildDocTitle1;->Document_Title_Child.DocumentName1)

The procedure:

`PROCEDURE DocumentTitleChange

`$1 is new text for field
`$2 is pointer to file field
`This is a comment character- no need to type obvious parameters. Probably better idea to do so.

All Records([Document_Title_Child) `Only one record in this file

IF (LockDisplayRecord(->Document_Title_Child)) `Calls a function I created
$2-> := TitleName `Assigns the new text to the file field
Save Record (Document_Title_Child)
Unload Record (Document_Title_Child)
END
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: