Home » Developer & Programmer » Forms » couple of quick questions
couple of quick questions [message #169903] Sun, 30 April 2006 05:38 Go to next message
Grazien
Messages: 7
Registered: April 2006
Junior Member
Hi all, ive just got a couple of relatively simple questions that are giving me grief.


The first question regards an image within a canvas, the image is currently set to change with the ID of a cd to it’s CD cover, when the CD ID is ‘1’, it will find the image entitled ‘1’ also, however, we are having trouble as despite doing this as stated in our documents for the assignment, the images still wont appear, the system states as shown in the procedure below 'This CD does not have a photo on file'.
Here is the trigger ‘when new record instance’ within the main ‘CD’ block

--this line allows missing image files to be handled in a more professional way using your own error message see below
:system.message_level := '25';

-- note this line displays a .jpg file which has a name that matches the value currently displayed in the forms cd_idno field.
read_image_file('c:\pics\'||:cd.cd_idno||'.jpeg','JPEG','CD.pic_image');

IF NOT FORM_SUCCESS THEN
message ('This CD does not have a photo on file');
end if;

-- reset message level
:SYSTEM.message_level := '0';


any idea why we cant get any images?



The second question is regarding a count function, I have a text box on my canvas that should show the number of agents in a region for a company, whilst I was shown how to create the procedure for this, I wasn’t told where to initialize it in the work.

Here is the procedure body

PROCEDURE count_agents IS
BEGIN
select count (*)
into :REGION.COUNT_AGENT
from AGENT
where agent.region_id = :R_id;
END;

Count agent is the name of the text file I want the data to go into, should the initialization trigger be in the block, or the canvas, or in the item?


any help at all would be greatly appreciated.
Paul
Re: couple of quick questions [message #169963 is a reply to message #169903] Mon, 01 May 2006 01:31 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What is the data type of ':cd.cd_idno'? If it is numeric use 'ltrim(rtrim(to_char(:cd.cd_idno)))' to make sure that there are no spaces around the number. You can use something similar but with no 'to_char' to strip blanks, but you should really do that in the When-Validate-Item trigger BEFORE you store the data. Also leave the message_level alone until you have your code working THEN set to '25' and '0'. Also, for a bonus mark, store the 'essage_level'before setting to '25' then set 'message_level' to the stored value versus setting it ALWAYS to '0'. It is possible that you may have set it to '5' or '10' somewhere else in your form.

Put this other code or the call to the code in the Post-Query trigger at the block level.

David
Previous Topic: How to retreive the list of printers connected to my pc in Developer/2000 forms 4.5
Next Topic: Sequence Number in Detail Block
Goto Forum:
  


Current Time: Fri Sep 20 11:27:24 CDT 2024