davidhamann/python-fmrest

Similar queries yield different foundset

Closed this issue · 3 comments

Hello there!

Thanks again for this fantastic library.

I am experiencing a odd situation, two seemingly similar find() yield different data against a self-hosted instance:

quote_id = '<id-of-another-table>'

results1 = fm_session.find([
    {'_sk_Quote_ID': quote_id}
])

results2 = fm_session.find([
    {
        '_sk_Quote_ID': quote_id,
        'd__AnotherField': 'BEEP BOOP'
    }
])

Looping through the first foundset:

for record in results1:
    if record.d__AnotherField == 'BEEP BOOP':
        print(record.to_dict())

Nothing gets printed

Then printing the results of the second foundset outputs what I expected in the previous loop.

for record in results2:
    print(record.to_dict())

I also tried printing the d__AnotherField field and they are missing

for record in results1:
	print(record.d__AnotherField)

But none of the printed values match "BEEP BOOP" as if they weren't there.

Any idea why are those records are missing from the results1?

I can see though the webui/app that those are there, plus the second query also returns what's expected.

Thanks for checking in. Unfortunately, I'm not sure I follow.

I created a test file (admin/admin):
test_beep_boop.fmp12.zip

Then I ran your code:

fm_session = fmrest.Server('https://my-server.com',
                    user='admin',
                    password='admin',
                    database='test_beep_boop',
                    layout='SomeTable',
                    verify_ssl=True
                   )
                   
fm_session.login()

quote_id = 'B41E0BBC-67E4-4AE3-813F-585E6650F948'

results1 = fm_session.find([
    {'_sk_Quote_ID': quote_id}
])

results2 = fm_session.find([
    {
        '_sk_Quote_ID': quote_id,
        'd__AnotherField': 'BEEP BOOP'
    }
])

print('Printing first')
for record in results1:
    if record.d__AnotherField == 'BEEP BOOP':
        print(record.to_dict())

print('Printing second')
for record in results2:
    print(record.to_dict())

fm_session.logout()

This results in:

Printing first
{'_sk_Quote_ID': 'B41E0BBC-67E4-4AE3-813F-585E6650F948', 'd__AnotherField': 'BEEP BOOP', 'recordId': '1', 'modId': '2'}
{'_sk_Quote_ID': 'B41E0BBC-67E4-4AE3-813F-585E6650F948', 'd__AnotherField': 'BEEP BOOP', 'recordId': '2', 'modId': '2'}
Printing second
{'_sk_Quote_ID': 'B41E0BBC-67E4-4AE3-813F-585E6650F948', 'd__AnotherField': 'BEEP BOOP', 'recordId': '1', 'modId': '2'}
{'_sk_Quote_ID': 'B41E0BBC-67E4-4AE3-813F-585E6650F948', 'd__AnotherField': 'BEEP BOOP', 'recordId': '2', 'modId': '2'}

Do you have different results? If yes, could you maybe create a minimal test file and provide it here?

Hey sorry for the late reply, I do see different results, I don't get anything on the Printing first of your example.

I will try tomorrow get some time on this, and provide better feedback, not sure about the example data since it's under NDAs most likely.

Hey,

so I had time to look at this and sorted it, the find wasn't returning all the data cause there's the default limit to 100 records and the ones I wanted where probably out of the cut...

Sorry about this, it's even in the the finding data example... 🤦 "Defaults are offset 1 (which is the first record), limit 100."

Thanks again for the nice package :)