0

Array switches from rid to nid

I have the following piece of code:

let allRGRecs := record(Leagues,leagueRecID).RiderGroups;
let finalRGsbyTeam := allRGRecs[false];
let getRidersByTeam := RidersAnnounced[TeamID = 119].RiderID;
let riderRGs := for rider in getRidersByTeam do
        array(finalRGsbyTeam, allRGRecs[contains(riderIDs, text(rider))])
    end;
debugValueInfo(riderRGs)

If I do a debugValueInfo() for line 1 it shows it is rid.

If I do a debugValueInfo() for line 2 it shows it is rid.

If i do a debugValueInfo() for line 4 it shows it is nid.

How can it switch suddenly from rid to nid?

3 replies

null
    • Alain_Fontaine
    • 19 hrs ago
    • Reported - view

    It seems that applying the "array()" function to a pair of arrays containing rids returns an array of nids.

    • Ninox developper
    • Jacques_TUR
    • 14 hrs ago
    • Reported - view

    to convert a rid into a nest, simply use rid.id. See here: https://docs.ninext.fr/create-delete-and-duplicate-24#_luvIdX0E

      • Fred
      • 13 hrs ago
      • Reported - view

      thanks, after playing around I found the solution:

      let allRGRecs := record(Leagues,leagueRecID).RiderGroups;
      let finalRGsbyTeam := allRGRecs[false].Id;
      let getRidersByTeam := RidersAnnounced[TeamID = 119].RiderID;
      let riderRGs := for rider in getRidersByTeam do
              finalRGsbyTeam := array(finalRGsbyTeam, allRGRecs[contains(riderIDs, text(rider))])
          end;
      debugValueInfo(finalRGsbyTeam)
      

      Just need to change line 2 from rid to nid and it all works.