You need to sign in to do that
Don't have an account?
![Artsiom Kaz Artsiom Kaz](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Get specific record from dataset in SAQL Tableau
I have a dataset with records.
It is required to me to get specific record for calculations in SAQL.
Is there any function to get specific record in SAQL, like in map in apex.
For example: dataset.get(id).
It is required to me to get specific record for calculations in SAQL.
Is there any function to get specific record in SAQL, like in map in apex.
For example: dataset.get(id).
https://trailhead.salesforce.com/trailblazer-community/groups/0F9300000009MBPCA2?tab=discussion for inputs on your ask.
Thanks,
Is there any function to get specific record in SAQL, like in map in apex.:
Try this:
Make sure name is mandatory or put a condition that string name must not be blank before filling the object into map.
Hope it helps.
CustomObject__c>([Select z.Name, z.Id From CustomObject__c z]);
The one that was flagged as correct by 'Admin' did what the OP explicitly asked not to do - loop through the list of records and add them to the Map one at a time.
You don't need to use the 'z' alias though.
https://www.onecognizant.net/
The order of the fields in the SOQL statement does not make a difference - when Apex casts the list to a Map it uses trhe Id as the Key.
In fact, you don't even need to include the Id as a field in the SOQL - I tried this with one of my Custom types and it works just fine, with the Id still be used as the Key: So, it is NOT possible to do what the OP asked for - create a Map with the Name as the Key, without using a loop to iterate over the list and build the map one record at a time.
One Cognizant (https://www.onecognizant.one/)