Extracting the BOM via SQL with history

We are evaluating combining Agile instances and I’ve been asked to create extracts using PLSQL that can be imported to another agile instance.  I’ve manged to get an extract for the current bom, but the correct historical one has eluded me as the components are not specifying a rev?  

I can use the change_in value to find the rev of the bom parent, but where can i find the change to determine the rev of the children?  Is this another table?

Agile User Asked on May 15, 2017 in IT and Networking.
Add Comment
3 Answer(s)

What job do you aspire to hold?
Get some job descriptions for that job to see what skill and experience is required?
Find some people doing the job (successfully) ask them what they think are the important skills, and behaviors to do the job well.
Be honest, what skill need do you have, are your behaviors the same as successful incumbents of the job.
The courses you need are those that teach your skills and behaviors you lack.

Thank you for taking my online careers planning course, I look forward to receiving the tuition fee shortly 😉

Agile Angel Answered on May 16, 2017.
Add Comment

To determine the component revision for usage in an assembly, simply get the component revision that is just previous or equal to from the release date of the assembly
revision.  Something on the order of :
select rev_number from rev where item=compID and released=1 and release_date <= cin_rel_date order by release_date desc;
 “compID” is the ID of the component item number, and “cin_rel_date” is the release date for the assembly revision. Define the above as a cursor, open the cursor in your script, get the first one (they are in descending order) and you should be good. Note that if nothing is returned (and that does happen), you can just get the latest revision – Preliminary is not an option, as you cannot release an assembly BOM with “preliminary” components.

Agile Angel Answered on May 16, 2017.
Add Comment

Kevin,

Thanks for that.  

I wrote a small function that i can slip into my queries and figured why not share.  I am passing in the Change_IN release date and component ID as inputs.  This has passed the 5 tricky bom test and we’re working on a larger selection.  

Feel free to berate as the internet sees fit to do.

————————————————–

CREATE OR REPLACE Function BomCompRev
( Rel_DT IN nVarchar2, Item_ID in Integer )
RETURN nvarchar2
IS
cREV nvarchar2(10);
cDT nvarchar2(30);

cursor c1 is
Select REV_NUMBER,to_char(R.RELEASE_DATE, ‘DD-MON-YYYY HH24:MI:SS’) reldate
from REV R
where R.ITEM = Item_ID
and R.RELEASE_DATE <= to_date(Rel_DT, ‘DD-MON-YYYY HH24:MI:SS’)
and RELEASED = 1
order by to_date(reldate, ‘DD-MON-YYYY HH24:MI:SS’) DESC;

BEGIN

open c1;
fetch c1 into cREV, cDT;

if c1%notfound then
cREV := ‘-‘;
end if;

close c1;

RETURN cREV;

EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,’An error was encountered – ‘||SQLCODE||’ -ERROR- ‘||SQLERRM);
END;

Agile User Answered on May 17, 2017.

Yeah, that looks fine. Agreed that as a function, you can call it inline with SQL.
 When I do data extracts, I usually use PL/SQL, and if I needed to get the component rev in more than 1 location, that is pretty much how I would do it.

on May 17, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.