Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting using Keys in Relation Table 1

Status
Not open for further replies.

wchestnut

Programmer
Aug 9, 2010
79
US
I'm back at my standard Browse screen.

Now I'm adding multiple Tabs to control sort order using Conditional Behavior. The Browse list contains fields from the primary file (A) and some from a number of related files (B and C).

By default, I have the sort set to a Key from the A file. I need the Tabs to be able to change to a Key sort from a Relation file. But when I click on the "..." button after the "Key to Use" field, I'm only presented with the primary A file's Keys. How can I set it to a Key from the B or C tables?
 
Hi!

The Browse template allows you to choose the Keys of the Primary table only. But you can always have a conditional sort to NOT have a key but choose the columns you want to sort on. Please be aware that unless your back end database is SQL or very fast, performance would be a problem for non-keyed sorts as it has to create a temporary index.

Regards
 
Okay, I'm now using a manually-filled pull-down to attempt to control the sorting manually. I have an Embed Source in the pull-down control ready to go using CASE CHOICE. What would be the command to sort by a relation field?
 
This is what I've tried so far:

---------------------------------------------------
! Set Sort Order
CASE CHOICE(?SortList)
OF 1
MESSAGE('Portfolio')
OF 2
MESSAGE('Company')
SORT(Queue:BrowsePortfolios,CO:Company)
OF 3
MESSAGE('Contact')
END
ForceRefresh = True
Do RefreshWindow
---------------------------------------------------

The MESSAGES are for testing purposes. I'm starting with trying to sort by Company. This doesn't seem to work.
 
Hi!

Is the Browse Page-loaded or File-loaded? B'coz if it is page-loaded, the Browse queue contains only ONE page of data. So, sorting the queue achieves only to sort the page of data.

The sort command should be ::

SORT(Queue:BrowsePortfolios, Queue:BrowsePortfolios.CO:Company)

If it is Page-loaded, do not do a "Do RefreshWindow" as it will possibly refresh the queue from the view/table again. Just a DISPLAY(?BrowseList) should do (replace ?BrowseList with the actual Browse control name).

Regards
 
If I use...

SORT(Queue:BrowsePortfolios, Queue:BrowsePortfolios.CO:Company)

I get an error during compile: Field not found: CO.Company

If I do this...

SORT(Queue:BrowsePortfolios, CO:Company)

It compiles without error but doesn't work.
 
Hi!

Which version of Clarion are you using?

Check the Generated Source by clicking on the FILLED button in the embeditor to see the structure of the queue. Based on what the columns in the Queue are called, use them accordingly in the SORT statement.

Regards
 
We are using Clarion 5. Is this what you were referring to?


! Start of "Data Section, Before Window Declaration"
! [Priority 1000]

BRW1::View:Browse VIEW(SALESPortfolios)
PROJECT(SPORT:Salesperson)
PROJECT(SPORT:Name)
PROJECT(SPORT:ID)
PROJECT(SPORT:Sequence)
JOIN(SLSPROSP:KeyPortfolio,SPORT:ID)
PROJECT(SLSPROSP:ClientRelationship)
PROJECT(SLSPROSP:CurrentCycleStepHeader)
PROJECT(SLSPROSP:CurrentCycleStepDetail)
PROJECT(SLSPROSP:DateLastEdited)
PROJECT(SLSPROSP:LastEditedBy)
PROJECT(SLSPROSP:ContactID)
PROJECT(SLSPROSP:CompanyCode)
JOIN(CON:KeyCCID,SLSPROSP:ContactID)
PROJECT(CON:AUTO_ID)
END
JOIN(CO:CompanyKey,SLSPROSP:CompanyCode)
PROJECT(CO:Company)
PROJECT(CO:CoPriority)
END
END
END

Queue:BrowsePortfolios QUEUE,PRE() ! Browsing Queue
BRW1::SPORT:Salesperson LIKE(SPORT:Salesperson) ! Queue Display field
BRW1::SPORT:Name LIKE(SPORT:Name) ! Queue Display field
BRW1::CO:Company LIKE(CO:Company) ! Queue Display field
BRW1::CO:CoPriority LIKE(CO:CoPriority) ! Queue Display field
BRW1::SLSPROSP:ClientRelationship LIKE(SLSPROSP:ClientRelationship) ! Queue Display field
BRW1::ContactFirstLast LIKE(ContactFirstLast) ! Queue Display field
BRW1::SLSPROSP:CurrentCycleStepHeader LIKE(SLSPROSP:CurrentCycleStepHeader) ! Queue Display field
BRW1::SLSPROSP:CurrentCycleStepDetail LIKE(SLSPROSP:CurrentCycleStepDetail) ! Queue Display field
BRW1::SLSPROSP:DateLastEdited LIKE(SLSPROSP:DateLastEdited) ! Queue Display field
BRW1::SLSPROSP:LastEditedBy LIKE(SLSPROSP:LastEditedBy) ! Queue Display field
BRW1::SPORT:ID LIKE(SPORT:ID) ! Queue Display field
BRW1::SPORT:Sequence LIKE(SPORT:Sequence) ! Queue Display field
BRW1::CON:AUTO_ID LIKE(CON:AUTO_ID) ! Queue Display field
BRW1::Mark BYTE ! Queue POSITION information
! Start of "End of list QUEUE"
! [Priority 5000]

! End of "End of list QUEUE
 
Hi!

Yes.

So your sort statement should be ::

SORT(Queue:BrowsePortfolios, Queue:BrowsePortfolios.BRW1::CO:Company)

The version of Clarion I use is v7.2 and I use the ABC template which makes it very difficult for me for me to know what works for you.

Regards
 
Yeah, I can imagine it being difficult even being 2 versions behind much less a different template. Nevertheless, you've been providing me with some excellent information -- including this time because THAT STATEMENT WORKED!! I thank you again!

BTW, if you happen to have a PayPal donation link, let me know! :)
 
Hi!

Glad it worked for you.

Thanks for the kind words.

I wish you have some sort of remote access ability to you workstation like LogMeIn or GotoMyPC. That way, I could have helped you earlier since seeing a Legacy application makes it easy to understand the bits.

Always look at the generated code (CLW) since that's the one which get compiled into the EXE and hence makes all the difference.

Regards
 
I'm sure the timing of our schedules might prove difficult, but thanks for the offer. Your replies here provide very helpful to me. Next time, I'll provide the CLW files so you can see them. Hopefully there won't be a next time, but I'm sure there will be!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top