Function's return value used inside awk

I have a file with the record of person:

cat > $TMP/record.txt
John Torres M Single 102353 Address
Mark Santos M Maried 103001 Address
Carla Maria F Maried 125653 Address
#!/bin/ksh
ManipulateID(){ 
	...
	return 0;
	... #or
	return 1;
}

cat $TMP/record.txt | awk 'BEGIN {printf ("%s", "'"`ManipulateID "$5"`"'")}'

The challenge I am facing is that I have to manipulate the 5th column in my file (record.txt) inside awk, then I have to pass the 5th column value to a
function in my script, the function will do some manipulation and test. The function will return 0 if the test is good and 1 if not. The returning
value of 0 and 1 will be return back to awk and awk will test it. If the returning value of my function is 0 awk will display the whole row ($0)
and do nothing if returning value of function is 1.

Anyone who can help me?

The use of cat with awk is redundant.
To call your script you can use the system() function.
Try this, if the returncode of your script is 0 (not true, hence the "!" before the system command) awk should print the whole line:

awk '!(system("ManipulateID "$5))' $TMP/record.txt

Regards

It's returning an error to me.

/tmp/myscript[2]: syntax error at line 3 : `(' unexpected

The line 3 here is the ManipulateID() {

#!/bin/ksh

ManipulateID() {
 some codes here
}

awk '!(system("ManipulateID "$5))' $TMP/record.txt

I though only unix commands (ex. date, ls, etc.) will only do inside the system() in awk

You can call programs or scripts with the system() command but not a shell function with awk within a script like this.
If you want to manipulate the data with a shell script, you have to use separate scripts, one to manipulate the data and one with the awk command, but why don't you manipulate the data within awk?
Anyhow, if you want to play around with it, the scripts should look like:

awk script (you can also type the awk command at the prompt):

#!/bin/sh

awk '!(system(".\ManipulateID "$5))' $TMP/record.txt

The ManipulateID script:

#!/bin/sh

echo $1        # This is the 5th field of awk passing as a parameter

# Manipulate the data here

if [ .. ]; then
  exit 0
else
  exit 1
fi

Regards

Something like this would work:

#! /bin/ksh

ManipulateID() {
  TEST=something
}

ManipulateID

echo  | awk -v var=$TEST '{printf "%s\n", var}'

Not sure if that helps you or not.