Modify Criteria

4 posts / 0 new
Last post
Metroid1402
Offline
Joined: 11/05/2018 - 17:56
Modify Criteria

Is there a way to grab the current critera and then change it without extracting a database? For example, say I import a general ledger into IDEA that has 5 columns:
1) Customer_Name
2) Debit
3) Credit
4) Reference
5) Account_Number
Each reference number is a unique journal entry that has both the credits and debits. So, suppose I isolate the records to revenue accounts that have a credit greater than $200,000. Suppose it results in 10 records, and I want to see where the other side of the entry is. Is there a way to grab the current criteria, grab the reference number from each of the visible records, then change the criteria to display them all? What I currently have is:
 
Sub Main
Dim db As database
dim newCriteria as string 
 
On Error Resume Next 
Set db = Client.CurrentDatabase() 
Set rs = db.RecordSet
 
' This is where I want to grab the current criteria, not hardcode it
rs.Criteria = "Account_Number = 4000 .and. Credit >= 200000"
 
rs.ToFirst 
rs.Next
newCriteria = "@list(REFERENCE,"
 
On Error GoTo EndOfRecordSet
 
For i = 1 To db.Count
newCriteria = newCriteria &"," & I'm not sure how to add quotations to a string & rs.ActiveRecord.GetCharValue("REFERENCE") & """
rs.Next
Next 
 
MsgBox "No records found"
Exit Sub 
EndOfRecordset:
newCriteria = newCriteria & ")"
'This is where I would put the new criteria in and display the records to the user
End Sub 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Unfortunately you can't use IDEAScript to display records.  It has to create a new database or if you want to display them then it would be done through a message box or a dialog.  Is that what you are looking for or are you looking for the display (filter) option when you do a criteria on a database?

nekhin
Offline
Joined: 08/27/2019 - 08:06

@ Brian:
Is it possible to grab the curren display filter for the database via script to use it for further selections etc?

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi nekhin,

Not that I know of, I don't think it is possible.

Brian