Skip to main content
May 1, 2023
Question

Return only two fields from the expression of the query record

  • May 1, 2023
  • 3 replies
  • 0 views

Here in this image the expression should only return seatno and gender field without pid.

Can anyone please help me with this?

    3 replies

    gopalk2865
    Participating Frequently
    May 1, 2023

    if you query  record type then by default primary key of that record will be available as output along with your selected fields.

    May 1, 2023

    Then how you will identify that a given record data is associated to which record? As Gopal answered, it is available by default for that particular reason only.

    There is no way/option to remove primary key from the queryRecordType() but you can manipulate the generated result by taking reference from below code.

    a!forEach(
      a!queryRecordType(
        recordType: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle',
        fields: {
          'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{7aa3dcda-863a-4271-9034-85821a2bd453}vehicleMake',
          'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{767a1f4c-ca0a-4df5-954d-cd0beba06e96}vehicleMileage'
        },
        filters: a!queryFilter(
          field: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{595da20e-a849-4c36-a57e-d569453c622f}vehicleId',
          operator: "in",
          value: {1,2,3,4}
        ),
        pagingInfo: a!pagingInfo(1, 10)
      ).data,
      'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle'(
        'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{7aa3dcda-863a-4271-9034-85821a2bd453}vehicleMake': fv!item['recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{7aa3dcda-863a-4271-9034-85821a2bd453}vehicleMake'],
        'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{767a1f4c-ca0a-4df5-954d-cd0beba06e96}vehicleMileage': fv!item['recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{767a1f4c-ca0a-4df5-954d-cd0beba06e96}vehicleMileage']
      )
    )

    stefanhelzle0001
    Brainy
    May 1, 2023

    Does this result in an actual problem? Or is it just not what you expected?