Good day.
I have a random issue with the browse template.
Perhaps someone can assist or had the same problem before.
I am using Clarion 11.1 and the standard ABC browse template - no third party tools on the browse either.
I am using MSQL as database driver.
I have a button with embedded code that use BRW.Q.FIELD to write the current selected field data to a variable and then use that to perform various actions.
This works 99.9% of the time BUT randomly the BRW.Q code will not return the current selected records data from the browse but the one below it or above it.
How can I ensure that the selected records data is passed?
Not Sure. What I would normally do is make FIELD hot, as in select it on the hot fields tab, and then just reference it. The classes and templates make sure it’s always the current selected.
Thats correct, the field is either in the browse or as a hot field.
Thats not the issue though, its almost like the visual selection randomly does not tie up with the actual selection.
Select the desired record in the browse and in the Button’s Accept embed point using this code: DivertLoad(BRW4.Q.DELM:DeliveryNo)
DivertLoad is a proc that needs the deliveryno as parameter
Does this answer your question?
Here is the full code section:
IF(BRW4.Q.DELM:TimeEnd > 0)
IF ((BRW4.Q.DELM:DeliveryNo = ‘’) OR (BRW4.Q.DELM:DeliveryNo = 0))
MESSAGE(‘No Delivery was selected’ ,‘Error’ ,ICON:Exclamation)
CYCLE
ELSE
IF (BRW4.Q.DELM:Diverted = 1)
MESSAGE(‘This Deivery was already diverted.|Only one divert per load is permitted!’ ,‘Already Diverted’ ,ICON:Exclamation)
CYCLE
ELSE
CASEMESSAGE('Are you sure you want to Divert Delivery '&BRW4.Q.DELM:DeliveryNo&‘?’,'Divert - '&BRW4.Q.DELM:DeliveryNo&‘?’,ICON:Question,Button:Yes + BUTTON:NO,Button:Yes,1)
OF Button:Yes
GetOTP (1)
IF (GLO:OTPSuccess = 1)
DivertLoad(BRW4.Q.DELM:DeliveryNo)
DO RefreshScreen
END
OF Button:No
CYCLE
END
END
END
ELSE
MESSAGE('This delivery was not Batched yet!|You can only Divert Batched Loads. ’ ,‘Delivery NOT Batched’ ,ICON:Exclamation)
Put it like this, how do you tell the record buffers what the highlighted record is?
There is GetViewPosition() which looks promising but I havent looked at the code in that browse interface method to see how it works. It might be a class method that does no more than return the same value as ?BrowseListControl{Prop:Selected} but it might also sync the record buffers for you…
I would recommend using YourBrowseClass.UpdateViewRecord()
This will load both the browse queue and the table record buffers based on the currently selected row. ThisWindow.Update() is going to call every ABC object on the window. I understand there might not be anything else in this specific procedure.
I dont have any of my old code/apps to refer to, so I just went off the examples in the help docs…
When your computers get hacked, you wipe everything even backups because even those could contain malware et al.
I even bought some soic clips to reflash the bios because I found a problem there and gigabyte sent me some experimental bioses to use to help nail down problems, but I now know its MS software being exploited…
I even found a bug in rsyslog where it would drop syslog msgs, in a way that could be exploitable.
To add a bit more detail … IIIRC … That does a REGET(View, Position) which one of its features is it fills “Complete Records” of Primary and Joined. The Record loaded by the NEXT(View) only loads the PROJECT’d fields for some drivers (most SQL, not TPS).
In this case the OP only wants a field in the Browse Queue, so it must have been PROJECT in the VIEW.
From the REGET() Help:
VIEW Usage
REGET reads the VIEW record identified by the string returned by the POSITION(view) procedure. The value contained in the string returned by the POSITION procedure, and its length, are file driver dependent. If the VIEW contains JOIN structures, REGET retrieves the appropriate set of related records.
REGET re-loads all the VIEW component files’ record buffers with complete records. It does not perform the relational “Project” operation. REGET(view) is explicitly designed to reset the record buffers to the appropriate records immediately prior to a CLOSE(view) statement. However, the processing sequence of the files must be reset with a SET or RESET statement.
Or make it a number with “0+” math:
GET(MyQ, (0 + ?MyList{PROP:Selected}) )
I would use CHOICE() as most obvious and reliable.
What was being proposed as the accepted answer, calling ThisWindow.Update(), calls the browse UpdateViewRecord. The issue I was pointing out was ThisWindow.Update() is going to call the update method for every WindowComponent in the procedure.
You don’t reference who, or what, you are replying to?
If it was me, I was not disagreeing. I was expanding what is done inside .UpdateViewRecord() is a REGET(View) that loads All Fields, else you may only have what Fields are PROJECT’d in the VIEW. Whch I’m sure you know, I was not sure the OP did.
Rick if you select some text in a post with the Mouse a Popup menu appears to let you Quote it so it can be in your Reply.