add_message.pl query
Hiya. I'm trying to amend the add_message.pl to add a standard message to some items at a particular homesite. I keep getting the following error message - Message id is invalid or type value does not match MESSAGE.TYPE
I've entered the following on the script -
# State the location and operator
$location = "ALF";
# Specify Message number
$message_id =10; (where this is message_id from the parameters)
# Specify message type Borrower=0 or Item=1
$message_type =1 ;
# State the location and operator
$location = "ALF";
$operator = "alflib";
And the following sql to only pick up the items that I want -
# Retrieve the borrower/items required
(@ids) = &sql($d,"
select ITEM_ID
from ITEM
where ACTIVE_SITE_ID=ALS AND STATUS_ID=5
");
Have followed the instructions and can't see where I am going wrong (but I must be going wrong somewhere!). Would be grateful if anyone could point me in the right direction. Thanks. Sharon



add_message.pl error message
I think the issue is a local data issue. You appear to have two rows in the MESSAGE table for the id value of 10. Each message has a different type. The script does some checks on the message id given and is only expecting one value. When two values are returned the scalar variable being used will only hold one row and it may well be holding the data from the row with type 0.
This would cause the script to output the error you are seeing because you have stated the type should be 1.
The solution would be to remove the duplicate row or to create a new standard message. It looks like the message ids from 1 to 16 are affected by the duplicates issue.
Also the line in the item sql is incorrect. The quotes are missing aroung the ACTIVE_SITE_ID are missing. It should be
where ACTIVE_SITE_ID='ALS' AND STATUS_ID=5
(Use single quotes within the SQL statement as double quotes indicate the boundaries of the whole SQL statement within the PERL script.
Thanks
Brian Crampton
Developer, Talis
Hi Brian. Thanks for that. I
Hi Brian. Thanks for that. I did as you suggested and removed the duplicate line. I had tried double quotes and that's where I was going wrong. Messages are now on! Thanks for your help. Sharon