How to query for the latest generation of items that the user has access to?

Former Member
Former Member
Hi, I would like to ignore the "is_current" property when querying for items, and instead return the latest generation of each item that the user has access to (i.e. permission to "get"). For instance, since the permission_id can change for a given config_id, the user might not be able to access the vary latest:  Can I do this in AML? Or do I need to do some SQL magic instead? Would be great if somebody could help me implement a method that does this. Or at least show me how I should approach the problem.  
Parents
  • Former Member
    Former Member
    I guess it's possible to do something like:
    SELECT P1.*
     FROM [InnovatorSample].[innovator].[PART] AS P1
     WHERE GENERATION = (
     SELECT MAX(GENERATION) FROM [InnovatorSample].[innovator].[PART] AS P2
     WHERE PERMISSION_ID IN ('95475AE006E7415794BDC93808DC04D2', 'A43FE707C3C54C90AD660D27A81AC58D') AND P1.CONFIG_ID = P2.CONFIG_ID)
     ORDER BY P1.NAME
    
    
    
Reply
  • Former Member
    Former Member
    I guess it's possible to do something like:
    SELECT P1.*
     FROM [InnovatorSample].[innovator].[PART] AS P1
     WHERE GENERATION = (
     SELECT MAX(GENERATION) FROM [InnovatorSample].[innovator].[PART] AS P2
     WHERE PERMISSION_ID IN ('95475AE006E7415794BDC93808DC04D2', 'A43FE707C3C54C90AD660D27A81AC58D') AND P1.CONFIG_ID = P2.CONFIG_ID)
     ORDER BY P1.NAME
    
    
    
Children
No Data