Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[HELP] Set Variables with multiple repetitions

Featured Replies

  • Newbies

Attention: Before posting in the general discussion forum please review the other forums that would best suit your topic.
If you cannot find one then you may delete this text and post your topic in this forum.

Hi everyone,

I have a table DEADSTOCK like that:

------------------------------------------
Product | Open          | Close
MER      | $10,757      | $764
OBU      | $6,590        | $78
PAT       | $2,471        | $0
RAP      | $9,253        | $261
RIT       | $1,252         | $0
-----------------------------------------

In monthly sales report (associated table: ORDERS), I need query table DEADSTOCK to extract a summary data, I used 3 variables have 5 repetitions as following:

1. $stock_depts

Let( [
    $query = "SELECT Product
           FROM DEADSTOCK
           ORDER BY Product ASC"    
    ; $result = ExecuteSQL($query; ""; ¶)
    ; $stock_depts[1] = GetValue ( $result; 1 )
    ; $stock_depts[2] = GetValue ( $result; 2 )
    ; $stock_depts[3] = GetValue ( $result; 3 )
    ; $stock_depts[4] = GetValue ( $result; 4 )
    ; $stock_depts[5] = GetValue ( $result; 5 )   
       ];   
    ""
)

2. $stock_open

Let( [
    $query = "SELECT Open
           FROM DEADSTOCK
           ORDER BY Product ASC"    
    ; $result = ExecuteSQL($query; ""; ¶)
    ; $stock_open[1] = GetValue ( $result; 1 )
    ; $stock_open[2] = GetValue ( $result; 2 )
    ; $stock_open[3] = GetValue ( $result; 3 )
    ; $stock_open[4] = GetValue ( $result; 4 )
    ; $stock_open[5] = GetValue ( $result; 5 )   
       ];   
    ""
)

3. $stock_close

Let( [
    $query = "SELECT Close
           FROM DEADSTOCK
           ORDER BY Product ASC"    
    ; $result = ExecuteSQL($query; ""; ¶)
    ; $stock_close[1] = GetValue ( $result; 1 )
    ; $stock_close[2] = GetValue ( $result; 2 )
    ; $stock_close[3] = GetValue ( $result; 3 )
    ; $stock_close[4] = GetValue ( $result; 4 )
    ; $stock_close[5] = GetValue ( $result; 5 )   
       ];   
    ""
)

In FileMaker 14, it works well and I got everything I need!

But after upgrading to FM 15, variable $stock_depts just returns 4 values: MER, OBU, PAT, RAP insteads of 5 values: MER, OBU, PAT, RAP, RIT but if I try to read value of local variable $result, it's still true: MER¶OBU¶PAT¶RAP¶RIT. And the others $stock_open & $stock_close are wrong similarly!

So what's the matter with my function? Please help me this case!

Thanks for reading my thread!

   

 

Works like a charm in 15... I think something off in your data?

I just copied and pasted your calc after creating the data.

 

 

2016-12-22_08-12-57.png

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.