Limiting a macro to run once per day

Well we have just been hit by a small glitch brick.

We have our prices being checked through by script - 500+ different items. If there are no sales over a period, it lowers the price and vice versa. When it is run and the price is changed the date is saved to an extended property.

On the next sync when it goes to run it again, it checks the date against the saved date and if it is less then a set period of time it skips it.

It has been working brilliantly for 5 weeks since it was launched.

Then last Thursday/Friday the script ran between 3 and 7 times incrementing the price each time.

Which implies that the database although being provided with an updated date extended property it was not being held/saved. Giving rise to the script running a number of times before it caught up, typically over the period of about an hour.

I am not quite sure of the extent of the damage alas we have fail safes in the so that they can never go below a minimum price. Still 5 weeks of price tracking down the plug hole.

Anyway - just wondering how I can go about ensuring that the server has recieved an updated date.

Is there some kind of confirmation that can be returned on update? Like a confirmation of a .ExecuteNonQuery()

Thanks in advance for any suggestions.

Which implies that the database although being provided with an updated date extended property it was not being held. Giving rise to the script running a number of times before it caught up, typically over the period of about an hour.


I am not quite sure of the extent of the damage alas we have fail safes in the so that they can never go below a minimum price. Still 5 weeks of price tracking down the plug hole.


Anyway - 



How do you edit a forum post in this new forum, there is a couple of paragraphs added onto the above by mistake.

You can't edit the forum post. You can vote for this feature to be implemented here: https://support.freshdesk.com/support/discussions/topics/308689


Scripting team should provide a feedback to you ASAP.

Hi,


I assume that your log script as being run at the end of the execution. If you wish to run a script once a day regardless of the outcome then store the execution date before script logic is being executed. This will truly give you one execution per day.


What this also means is that if the script fails it will not re-attempt it on that day.


Regards,

Hi Matt


Thanks for the input. I most definitely will be storing the execution date first. That is a pretty easy move around. Just some logic to go through.


I think the trouble came about as the extended property was not being updated on the server. The logs seem to show on some occasions the date would be updated days after the price.


I am guessing the two are running on separate systems. "extended properties" on one and "listing descriptions" on another.


Is there a way of confirming it has been updated that you are aware of? I know in bluetooth and a number of other coms protocols the unit would respond with "OK" or something similar to confirm it was processed.


Just a quick question, is there a simple way of getting the sales for the past week of each item. There seem to be a number of reports that can do it, but is it easy to do in script?


Thank you so much for the help.

Hi,


I am guessing the two are running on separate systems. "extended properties" on one and "listing descriptions" on another.


For eBay pricing, we are using an extended property for RRP and listing description price for a sale price. For Amazon both are stored in listing description price.


Is there a way of confirming it has been updated that you are aware of? I know in bluetooth and a number of other coms protocols the unit would respond with "OK" or something similar to confirm it was processed.


Each database table has modified date field which implies when the values got changed. To know exactly when the pricing was accepted by channel one needs to check audit trail of the stock item. Each time you run execute non-query function it returns the number of rows affected. That should be used to determine if the response is a success or not.



Just a quick question, is there a simple way of getting the sales for the past week of each item. There seem to be a number of reports that can do it, but is it easy to do in script?

Dashboard -> Query Data reports are the best way to get that information. It is not hard to do in the script ,however, it depends on your requirements. 


Regards,


Well we have had a somewhat major issue again.


Even though date is stored prior to running and a confirmation of the change has been received from the server. 


The data still isn't being saved or is not being made visible to the rest of the system for a long time after the command is run. Which defeats the point of attempting to limit it to running once a day.


The audits show the  script executed twice within less then 7 minutes, without the sync button being pressed and the auto sync is set for every 10 minutes. Even then there seems to be a weird situation where NO workstations were on and the script has been run.


Are macro scripts being added to the .net system and being allowed to run all the time without a desktop application being live?


This seems like such a simple task and yet we are struggling.

Hello,


Macro scripts will be added to Linnworks.net , however, they will be many limitations in place. 


If the issue still persists can you please raise a support ticket and we can deal with it individually.


Login to post a comment