# Browse BRW.Q.FIELD Not Returning Selected Record

**URL:** <https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615>\
**Category:** questions\
**Tags:** browse\
**Created:** [October 29, 2024, 7:34am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615 "2024-10-29T07:34:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![GerhardZeelie](https://clarionhub.com/user_avatar/clarionhub.com/gerhardzeelie/32/1598_2.png) [@GerhardZeelie](https://clarionhub.com/u/GerhardZeelie)\
**Post date:** [October 29, 2024, 7:34am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/1 "2024-10-29T07:34:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [October 29, 2024, 7:58am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/2 "2024-10-29T07:58:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GerhardZeelie](https://clarionhub.com/user_avatar/clarionhub.com/gerhardzeelie/32/1598_2.png) [@GerhardZeelie](https://clarionhub.com/u/GerhardZeelie)\
**Post date:** [October 29, 2024, 8:33am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/3 "2024-10-29T08:33:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Clarion\_clarion](https://clarionhub.com/user_avatar/clarionhub.com/clarion_clarion/32/636_2.png) [@Clarion\_clarion](https://clarionhub.com/u/Clarion_clarion)\
**Post date:** [October 29, 2024, 9:13am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/4 "2024-10-29T09:13:18Z")

</div>

how did you get the selected row from BRW.Q??

---

<div class="post-metadata">

**Author:** ![GerhardZeelie](https://clarionhub.com/user_avatar/clarionhub.com/gerhardzeelie/32/1598_2.png) [@GerhardZeelie](https://clarionhub.com/u/GerhardZeelie)\
**Post date:** [October 29, 2024, 9:55am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/5 "2024-10-29T09:55:43Z")

</div>

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**

**CASE**  **MESSAGE** ( **'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)

**CYCLE**

**END**

---

<div class="post-metadata">

**Author:** ![Clarion\_clarion](https://clarionhub.com/user_avatar/clarionhub.com/clarion_clarion/32/636_2.png) [@Clarion\_clarion](https://clarionhub.com/u/Clarion_clarion)\
**Post date:** [October 29, 2024, 10:17am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/6 "2024-10-29T10:17:43Z")

</div>

Why are you using BRW4.Q.DELM:DeliveryNo ??

just use DivertLoad(DELM:DeliveryNo)

---

<div class="post-metadata">

**Author:** ![GerhardZeelie](https://clarionhub.com/user_avatar/clarionhub.com/gerhardzeelie/32/1598_2.png) [@GerhardZeelie](https://clarionhub.com/u/GerhardZeelie)\
**Post date:** [October 29, 2024, 10:26am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/7 "2024-10-29T10:26:20Z")

</div>

Its how I’ve always done it 🙂

Do you suggest dropping the browse.Q will fix my problem?

---

<div class="post-metadata">

**Author:** ![Clarion\_clarion](https://clarionhub.com/user_avatar/clarionhub.com/clarion_clarion/32/636_2.png) [@Clarion\_clarion](https://clarionhub.com/u/Clarion_clarion)\
**Post date:** [October 29, 2024, 10:42am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/8 "2024-10-29T10:42:09Z")

</div>

I suppose you have this code in the Button’s Accept - “Control Event Handling, after generated code”  
so it will have

```auto
   OF ?Button:here
      ThisWindow.Update()
      you code

```

in this case, you can use PRE:ColumnName

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [October 29, 2024, 10:44am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/9 "2024-10-29T10:44:48Z")

</div>

Wheres your Get(BrwX.Q,?BrowseListControlName{prop:Selected}) ?

You need to prop:selected the highlighted q entry before you can pass anything from the BrwX.Q.

---

<div class="post-metadata">

**Author:** ![GerhardZeelie](https://clarionhub.com/user_avatar/clarionhub.com/gerhardzeelie/32/1598_2.png) [@GerhardZeelie](https://clarionhub.com/u/GerhardZeelie)\
**Post date:** [October 29, 2024, 10:50am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/10 "2024-10-29T10:50:06Z")

</div>

I dont.  
This must be my problem then!

Will implement and test my side.  
Thank you

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [October 29, 2024, 10:54am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/11 "2024-10-29T10:54:32Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![GerhardZeelie](https://clarionhub.com/user_avatar/clarionhub.com/gerhardzeelie/32/1598_2.png) [@GerhardZeelie](https://clarionhub.com/u/GerhardZeelie)\
**Post date:** [October 29, 2024, 1:36pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/12 "2024-10-29T13:36:08Z")

</div>

> [@Clarion\_clarion](#):
>
> `ThisWindow.Update()`

Calling ThisWindow.Update() before my code seems to have fixed the issue.  
Thank you!

---

<div class="post-metadata">

**Author:** ![Rick\_UpperPark](https://clarionhub.com/user_avatar/clarionhub.com/rick_upperpark/32/346_2.png) [@Rick\_UpperPark](https://clarionhub.com/u/Rick_UpperPark)\
**Post date:** [October 29, 2024, 1:43pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/13 "2024-10-29T13:43:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [October 29, 2024, 1:55pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/14 "2024-10-29T13:55:58Z")

</div>

> [@RchdR](#):
>
> Get(BrwX.Q,?BrowseListControlName{prop:Selected}) ?

FWIW - This is one of those situations where many of us have earned our lumps the hard way.

There are several flavors of GET().

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/8/8731fc91ae5a6da65f878b87a933fd0dc616c8ef.png)

Since PROP:Selected returns a STRING, you get the wrong flavor of GET().

You should either do something like this:

```clarion
MyInt = ?MyList{PROP:Selected}
GET(MyQ,MyInt) ! No ambiguity here

```

OR you could use CHOICE()

```clarion
GET(?MyQ,CHOICE(?MyList))

```

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [October 29, 2024, 2:12pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/15 "2024-10-29T14:12:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [October 29, 2024, 7:06pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/16 "2024-10-29T19:06:20Z")

</div>

> [@Rick\_UpperPark](#):
>
> I would recommend using  
> `YourBrowseClass.UpdateViewRecord()`
> 
> This will load both the browse queue and the table record buffers based on the currently selected row.

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.

* * *

> [@jslarve](#):
>
> ```auto
> MyInt = ?MyList{PROP:Selected}
> GET(MyQ,MyInt) ! No ambiguity here
> 
> ```

Or make it a number with “0+” math:

```auto
GET(MyQ, (0 + ?MyList{PROP:Selected}) )

```

I would use CHOICE() as most obvious and reliable.

---

<div class="post-metadata">

**Author:** ![Rick\_UpperPark](https://clarionhub.com/user_avatar/clarionhub.com/rick_upperpark/32/346_2.png) [@Rick\_UpperPark](https://clarionhub.com/u/Rick_UpperPark)\
**Post date:** [October 29, 2024, 7:15pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/17 "2024-10-29T19:15:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jorge-paladino](https://clarionhub.com/user_avatar/clarionhub.com/jorge-paladino/32/2847_2.png) [@jorge-paladino](https://clarionhub.com/u/jorge-paladino)\
**Post date:** [October 29, 2024, 9:23pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/18 "2024-10-29T21:23:44Z")

</div>

I use it a lot like this  
`GET(BrwNº.Q,CHOICE(?MyList))`  
`Loc:Car=BrwNº.Q.field ....`

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/9/95924c19d2d5433a379f75ab9715e0e6ea2adad3.png)

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [October 29, 2024, 9:38pm UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/19 "2024-10-29T21:38:05Z")

</div>

> [@Rick\_UpperPark](#):
>
> What was being proposed as the accepted answer, calling ThisWindow.Update(), calls the browse UpdateViewRecord.

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.

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/9/9e480844b04fa71cdf5abf8f675783df657a9190.png)

---

<div class="post-metadata">

**Author:** ![GerhardZeelie](https://clarionhub.com/user_avatar/clarionhub.com/gerhardzeelie/32/1598_2.png) [@GerhardZeelie](https://clarionhub.com/u/GerhardZeelie)\
**Post date:** [October 30, 2024, 6:04am UTC](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615/20 "2024-10-30T06:04:23Z")

</div>

Thank you everyone for the assistance and input!  
Everyone’s contribution has directed me to a solution.

[Next page](https://clarionhub.com/t/browse-brw-q-field-not-returning-selected-record/7615.md?page=2)
