Hi,
I have to fix some prehistoric code written using ADM1 framework. Unfortunately, I am not familiar with ADM1 nor ADM2. I was able to fix some initial problems, but now I am stuck with following: I have tabbed view (Folder). When I change value of a fill-in field in first tab, it should change value of another fill-in in second tab, and then apply "LEAVE" trigger to that field, so that other fields on that tab are also populated. I did it using PUBLISH/SUBSCRIBE, but I expect this is not standard way in ADM1. Maybe that leads to current problem: fields on second tab are filled as expected, but when I choose "OK" button, changes are not saved. Looks like it doesn't know, that the values have been changed (The standard question "Do you wish to save..." does not appear). When I type anything to any field on second tab everything is saved as expected. So the question is: how to let ADM1 know that values on the second tab have been changed ?
BTW, is there any documentation regarding ADM1 available ?
Regards,
Piotr
Brian,
Thanks for hint.. In fact I tried it myself without success, but it was because I tried to set MODIFIED attribute to the field which was not ENABLED. So now I am one step forward. Now it works, but only if I switch to that second tab at least once (no need to update anything there). But if I don't it still does not notice MODIFIED attribute :(
Regards,
Piotr
Brian,
Unfortunately, it does not work :( Now it shows second tab for a moment with all fields filled, but still it does not save it.
I tried to experiment with this:
RUN dispatch IN h_v-adr_2 (INPUT 'assign-record':U).
h_v-adr_2 is the handle to second tab.
It does force save, but without question. Maybe there is something else to 'dispatch' to simulate standard behaviour ?
Regards,
Piotr
Instead of assign-record, try with 'update-record'.
Just a few questions.
Are you using an update-panel ?
Could you tell us what are the current smart links of the objects? ( right click on the window -> SmartLinks ).
No, there is no update-panel.
Current links are:
h_folder Page THIS-PROCEDURE
h_folder State h_v-adr_1
h_folder State h_v-adr_2
h_folder State h_v-adr_3
h_v-adr_1 UpdateBIC h_v-adr_2
h_v-adr_2 UpdateBIC h_v-adr_1
THIS-PROCEDURE State h_folder
THIS-PROCEDURE Record h_v-adr_1
THIS-PROCEDURE State h_v-adr_1
THIS-PROCEDURE TableIO h_v-adr_1
THIS-PROCEDURE Record h_v-adr_2
THIS-PROCEDURE TableIO h_v-adr_2
THIS-PROCEDURE Record h_v-adr_3
THIS-PROCEDURE TableIO h_v-adr_3
Some explanation on this: h_v-adr_1,2,3 are handles to three existing SmartViewers on three tabs of h_folder. UpdateBIC is my custom link type which I wanted to use to communicate between tab 1 and tab 2. At the end I used PUBLISH/SUBSCRIBE, as I didn't know how to raise UpdateBIC event, but I had to leave these links there, as without them second tab was not initialized at the beginning, so I could not SUBSCRIBE.
The dialog have only this tabbed folder and OK and Cancel buttons, nothing more.
update-record also does not ask before save.
You don't need to create two links for UpdateBIC. Moreover it can cause a deadlock.
Everytime you use a link you need to specify whether it is the Source or the Target.
I'll show some examples that might be handy.
Considering you only have the following link:
h_v-adr_1 UpdateBIC h_v-adr_2
To execute a procedure in another object :
run notify ('proc-name', 'link-type').
eg: run notify ('some-proc', 'UpdateBIC-target').
(it will execute 'some-proc' inside h_v-adr_2).
To send parameters to another object:
run set-link-attribute in adm-broker-hdl ( 'source-proc-handle' , 'link-type', 'att=val, att=val').
e.g
inside h_v-adr_1
run set-link-attribute in adm-brojer-hdl (THIS-PROCEDURE, 'UpdateBIC-targe', 'att=value,att=value,...').
to get the value of the attribute inside h_v-adr_1
RUN GET-ATTRIBUTE (INPUT 'att').
char-var = RETURN-VALUE.
These UpdateBIC links were not functional - as I wrote before, I left them there just to force initialization of both tabs. Real communication went through PUBLISH/SUBSCRIBE. But now I tried to go back to standard ADM1 communication based on what you wrote. I left just one UpdateBIC link, with v_h-adr_1 as Source and v_h-adr_2 as Target.
The syntax of 'notify' you sent seems to be wrong - it takes just one parameter, so I think it should be either
RUN notify('UpdateBIC')
or
RUN notify('UpdateBIC,UpdateBIC-TARGET')
I tried both. In first case I got error "Method name UpdateBIC not found in 'notify'". In second case nothing happened.
I did some debugging. In broker-notify procedure found in adm\method\broksmrt.i which is supposed to process notify, there is no entry in adm-link-buffer table with link-type "UpdateBIC", that's why it does not do anything.
Also, when I look at attributes of both v_h-adr_1 and v_h-adr_2 there is no UpdateBIC among SUPPORTED-LINKS. Isn't it a problem ? How can I add it there ? In Advanced Procedure Settings window button Add for Supported SmartLinks is not active.
OK, I found the reason. The UpdateBIC link between v_h-adr_1 and v_h-adr_2 is really created only after I click on v_h-adr_2. After that the communication works. But that means, that I got to the same point as I had been before using PUBLISH/SUBSCRIBE: I need to artificially add second UpdateBIC link in opposite direction to initialize second tab, and still data updated on second tab with UpdateBIC procedure are not saved until I switch to second tab at least once.
Where did you place the RUN notify ?
Are you still executing init-pages as Brian mentioned?
Piotr,
It sounds like the UpdateBIC link is only being established during the application execution and not as part of the initialization. I think you should check each of the programs that use the UpdateBIC link and ensure that the link is properly established during initialization.
Alternatively, ensure that the correct pages are being initialized in init-pages.
Brian
P.S. UpdateBIC is not a standard link type. It is a custom link type that the original developer created.
RUN notify is in LEAVE trigger of one of fields in v_h-adr_1. I tried with and without init-pages, the behaviour is the same.
Brian,
You are right - I have to call init-pages or add-link explicitly in local-create-objects. That way I enforce link creation during initialization process, so it works withou clicking on second tab and I don't have to use workaround with reverse-direction link. That's OK.
BTW, UpdateBIC link was not created in the past - I created it now.
But still I have a problem, that if I never go to second tab (h_v-adr_2), values which were populated there by UpdateBIC procedure will not be saved, until I explicitly call RUN dispatch IN h_v-adr_2 (INPUT 'update-record':U) in the trigger of OK button in main dialog. And update-record does not ask standard "Do you wish to save..." question. I have workaround for that - if it happens, I can put this question in my code before call to update-record, but I just want to understand why it goes this way.
Piotr,
I am not certain why that is happening, however, you can turn on 4GL Tracing and get a log file of what calls are being made so I would do that then run the app and manually switch to the second tab then analyze the resulting log file.
You could then do the same thing without manually switching to the second tab and compare the resulting logs.
It might give you just enough to figure out what you need to do.
The startup parameters to use are:
-clientlog some_file_name_goes_here
-logginglevel 3
-logentrytypes 4GLTrace
Sorry I don't remember much of ADM1 anymore. I supported it for years but we only get a couple of calls per year on it. Most ADM calls we get in support are for ADM2 which is very different from ADM1.
Brian
Hi Gupta,
Can you be more specific please ?
Regards,
Piotr