Browse the versions of an item

Hi everyone ,

I'm currently trying to implement a C# method that should be able to browse all the versions of a

Part Item ,

thus we can read the states of the different versions and promote them .

but the problem is that I don't know how to get the versions of an Item .

Does anyone know how to solve this issue please ? 

Thanks in Advance 
Hamdi 

Parents
  • Hi Hamdi,

    in order to get all versions of an item you can query for items with a specific config_id (stable throughout all versions of an item) by specifying the condition "is not null" on the id property.
    In AML:

    <Item type="Part" action="get">
        <id condition="is not null" />
        <config_id>configIdOfTheItem</config_id>
    </Item>

    or using IOM (assuming we have an Innovator object called inn):

    var allVersions = inn.newItem("Part", "get");
    allVersions.setProperty("config_id", configIdOfItem);
    allVersions.setPropertyCondition("id", "is not null");
    allVersions = allVersions.apply();

    Hope this helps,

    C

  • How I can pass multiple Config ID?

    I tried this way, But is not working for me, Can you please suggest here?

    let item = inn.newItem('Part', 'get');
    item.setProperty('classification', 'TYPE-A');
    item.setPropertyCondition("NAME", 'like');
    item.setProperty("NAME", `%Value_2%`);
    item = item.apply();
    let config_Id = []
    for (let i = 0; item.getItemCount() > i; i++) {
        var current_Item = item.getItemByIndex(i);
        config_Id.push(current_Item.getProperty("config_id"))
    }
    let all_version = inn.newItem('Part', 'get');
    all_version.setProperty('config_id', config_Id.join(","));
    all_version=all_version.apply();
    Thanks
    Vinoth S
  • Hi Vinoth,

    I think you’re pretty close. Try these two tweaks to the last few lines of your method:

    let all_version = inn.newItem('Part', 'get');

    all_version.setProperty('config_id', config_Id.join("|"));
    all_version.setPropertyCondition('config_id', 'like');
    all_version=all_version.apply();
Reply Children
No Data