Number of weekdays and weekend days between 2 dates

24 posts / 0 new
Last post
borderraux
Offline
Joined: 10/22/2018 - 08:39

This is the version i am using:
Client Version: 10.3.0.1139 (X86 )
However before posting my reply yesterday I tried to run it and it didnt work...
 

borderraux
Offline
Joined: 10/22/2018 - 08:39

This is the version i am using:
Client Version: 10.3.0.1139 (X86 )
However before posting my reply yesterday I tried to run it and it didnt work...
 

ravisdxb
Offline
Joined: 01/13/2019 - 06:12

You need to enable an option for running Python within IDEA. Please refer to enclosed image. 
File -> Options -> Run Python Scripts

Images: 
borderraux
Offline
Joined: 10/22/2018 - 08:39

Thanks Ravi but that was the first thing i have done - if you try to run Python function without that option checked then IDEA generates explicit error message prompting user to check that boc.
Unfortunately that is not the issue.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hello borderraux,

This is what I did.  I first downloaded the python custom function and saved it in the Custom Functions.ILB directory under the project I am going to use it.

I changed the extension to .py and removed the .txt portion. 

I then created a character virtual field of length 40.

and entered the following equation.  I am using the Sample-Payments from the Sample project folder.

When I run this equation I get the following:

If you are stil having problems let us know what they are.  I can't remember which language version you are using but in some languages you will have to change the commas "," to semi-colons ";" in the equation editor for field separators.

Brian

borderraux
Offline
Joined: 10/22/2018 - 08:39

Thank you Brian.
Please see the sequence of the screenshots i have taken while trying to run the function.
As you can see from the attached screenshots today I cannot even see the function being present in Custom Function.ILB folder (that wasnt the case yesterday and day before yesterday)....
 

Images: 
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hello borderraux,

You won't see it as a custom function as it is in python and needs to be called from the @python() function.  Try my @python equation in my previous post with your dates and let me know if it works.  

Brian

borderraux
Offline
Joined: 10/22/2018 - 08:39

cont.
I am not sure if that matters (or what consequences it might have) but i have noticed that after placing the python function file within the Custom FUnction folder there is another folder created '_pycache_' within about 15 minutes ...

Images: 
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

That is normal for python.  In theory because of it your python script should work quicker the next time you run it.

borderraux
Offline
Joined: 10/22/2018 - 08:39

Thank you Brian, all worked ok - i modified the function slightly to display as a result the numbers of weekdays/weekends rather that the string as well.
 Ravi , thank you for providing the function in first place - it seems that I just didnt realise that Python function can be run by IDEA even if it is not visible physically to the user.

Images: 

Pages