Hi, I'm having a problem with a program and I'm wondering if some one can help me here
It's a little bit complex so I'll start with the structure
1- I created a catalog with no attribute just description (Items)
2- an information register (ItemsInfortmationResgister) with:
a- dimension (Name) type: catalogref.items then I checked the Master check box ... by that way a reference for the information register will appear in the catalog form
b- a resource (price) type: number
and the problem is I want to make sure that if the user created one catalog he must create an information register for it and make sure the price dimension is filled as well
so I did so :
| Code |
|---|
&Atserver
Function CancelTheCatalog()
f=0;
Query = New Query;
Query.Text = "SEL ECT * FR OM InformationRegister.ItemsInformationRegister ";
Selection = Query.Execute().Choose();
if Selection.Count()=0 then
f=1;
endif;
While Selection.Next() do
if not string(Selection.name)=String(Object.Description) then
f=1;
endif;
if string(Selection.name)=String(Object.Description) and Selection.price=0 then
f=1;
endif;
enddo;
return f;
EndFunction
&AtClient
Procedure BeforeWrite(Cancel, WriteParameters)
f=CancelTheCatalog();
if f=1 then
cancel=True
endif;
EndProcedure
|
the catalog will never write anything as long as there is no record
in the information register related to it
but when the program run, when the user is creating a catalog and want to enter to the reference of the information register in the left the program will display the following message :
"Data has not been yet recorded
switching to "item information register" is allowed only after data is recorded
the data will be recorded"
but my code won't let it to record and the program will stuck and never work because the data won't be recorded and you can't create
an information register record without writing the catalog.
this is the problem i know it seems impossible but can someone give me another suggestion or something to avoid this struggle, I'll be so thankful because it very important to me to do this task ... and thanks in advance