Skip to main content

Hello,

we have a lot old shift references for our FME’s which are in the past.

Does anyone have an API to delete them via Import?

 

I tried to build own API, but this is giving error message that at least one valid shift must be there, allthough there are many shifts and the one I try to delete is in the past

 

 

<root
    xmlns:dt="urn:schemas-microsoft-com:datatypes"
    xmlns="http://astea.com.schema.bc.employee">
    <session email="" alias="">
        <state bc_name="employee">
            <action name="data">
                <main>
                    <row number="1">
                        <person_person_id in_var="" out_var="">xxx</person_person_id>
                        <node_id in_var="" out_var="">DE-WEST</node_id>
                        <lang_id in_var="" out_var="">GER</lang_id>
                        <first_name in_var="" out_var="">xxx</first_name>
                        <last_name in_var="" out_var="">xxx</last_name>
                    </row>
                </main>
                <employee_shift_xref>
                    <row number="1" search_key="unique_id;xxx2021-09-03" delete="true">
                  </row>
                </employee_shift_xref>
            </action>
        </state>
    </session>
</root>

 

Thank you a lot & regards

Torste

I do not have an API, but I do have a SQL script provided by Astea to manage the employee shifts. We run once a year.

 

--US0009154 

--Backup Table
/* select * into person_shift_xref_bkup_20211110 from person_shift_xref */

/* delete */
select * from person_shift_xref 
where (effective_start_dt  >='2008-01-01 00:00:00.000'  and effective_end_dt <='2020-10-31 00:00:00.000') order by effective_start_dt

/*
delete from person_shift_xref
where (person_shift_xref.person_id in(select person_id from employee em where em.node_id='SG-PA') and person_shift_xref.effective_start_dt  >='2008-01-01 00:00:00.000'  and person_shift_xref.effective_end_dt <='2020-10-31 00:00:00.000')

delete from person_shift_xref
where (effective_start_dt  >='2008-01-01 00:00:00.000' and effective_end_dt <='2020-10-31 00:00:00.000') 
*/


Hi Torsten,

 

An employee must have at least one working shift definition.

You cannot delete it unless the person has multiple shifts.

If the shift is no longer valid, I suggest that you update it with the new and current value.

Below is the API sample for an update. The red line is the new shift_id.

<root
    xmlns:dt="urn:schemas-microsoft-com:datatypes"
    xmlns="http://astea.com.schema.bc.employee">
    <session email="" alias="">
        <state bc_name="employee">
            <action name="data">
                <main>
                    <row number="1">
                        <person_id in_var="" out_var="">xxx</person_id>
                        <node_id in_var="" out_var="">DE-WEST</node_id>
                        <lang_id in_var="" out_var="">GER</lang_id>
                        <first_name in_var="" out_var="">xxx</first_name>
                        <last_name in_var="" out_var="">xxx</last_name>
                    </row>
                </main>
                <employee_shift_xref>
                    <row number="1" search_key="unique_id;xxx">
                        <shift_id in_var="" out_var="">x</shift_id>
                        <effective_start_dt in_var="" out_var="">YYYY-MM-DD</effective_start_dt>
                    </row>
                </employee_shift_xref>
            </action>
        </state>
    </session>
</root>

.

Regards,

Joshua


Hello all,

 

thanks a lot so far. Your help is highly appreciated 👍

My problem is, that on my first screen the person has around 600 shift entrys. The one I tried to delete is an very old one, so it is not valid any more and he has valid current shifts for current date.

Nevertheless the API is giving the error, that at least one valid shift must be there. I try to show more detailled with the following screens:

 

 

 

 

 

Regards

Torsten


Hi Torsten,

 

Please try the below syntax for deletion in employee_shift_xref section

 

<employee_shift_xref>
    <row delete="true">
        <unique_id>0000xxx</unique_id>
        <bo_search_keys>
            <item>
                <name>unique_id</name>
                <value>0000xxx</value>
            </item>
        </bo_search_keys>
    </row>
</employee_shift_xref>

 

Regards,

Joshua


Hello,

 

thanks again all participants for supporting here. But still the API is not working. :-(

 

 

I think the API in main section tries to create new employee data. That would also explain, why I am getting with first API the message, that one shift must be there.

 

Any more ideas?

 

Thanks a lot & Regards

Torsten

 

full API:

 

<root
    xmlns:dt="urn:schemas-microsoft-com:datatypes"
    xmlns="http://astea.com.schema.bc.employee">
    <session email="" alias="">
        <state bc_name="employee">
            <action name="update">
                <main>
                    <row number="1">
                        <person_person_id in_var="" out_var="">xxxxx</person_person_id>
                        <node_id in_var="" out_var="">DE-NORTH/EAST</node_id>
                        <lang_id in_var="" out_var="">GER</lang_id>
                        <first_name in_var="" out_var="">xxxxx</first_name>
                        <last_name in_var="" out_var="">xxxxx</last_name>
                    </row>
                </main>
                <employee_shift_xref>
                    <row delete="true">
                        <unique_id>00000439</unique_id>
                        <bo_search_keys>
                            <item>
                                <name>unique_id</name>
                                <value>00000439</value>
                            </item>
                        </bo_search_keys>
                    </row>
                </employee_shift_xref>
            </action>
        </state>
    </session>
</root>


Hi Torsten,

 

Please don’t use person_person_id. Just person_id.

Please use below API

<root
    xmlns:dt="urn:schemas-microsoft-com:datatypes"
    xmlns="http://astea.com.schema.bc.employee">
    <session email="" alias="">
        <state bc_name="employee">
            <action name="data">
                <main>
                    <row number="1">
                        <person_id in_var="" out_var="">xxx</person_id>
                        <node_id in_var="" out_var="">DE-WEST</node_id>
                        <lang_id in_var="" out_var="">GER</lang_id>
                        <first_name in_var="" out_var="">xxx</first_name>
                        <last_name in_var="" out_var="">xxx</last_name>
                    </row>
                </main>
                <employee_shift_xref>
                    <row delete="true">
                        <unique_id>00000439</unique_id>
                        <bo_search_keys>
                            <item>
                                <name>unique_id</name>
                                <value>00000439</value>
                            </item>
                        </bo_search_keys>
                    </row>
                </employee_shift_xref>
            </action>
        </state>
    </session>
</root>


Thanks a lot Joshua - working! Great! 👍👌

 

Thanks also again ktolkacevic for providing the SQL script. 👍


Reply