Chinnakanna C Posted July 25, 2023 Share Posted July 25, 2023 Hello Experts, How to get the number of days from a given month in Tibco BW 6.x? Thanks in advance. Link to comment Share on other sites More sharing options...
Julio Gimenes 2 Posted August 23, 2023 Share Posted August 23, 2023 Hello @Chinnakanna C Natively, I'm not aware of any built-in function that can return the information you need. Alternatively, you can obtain this information using Java in a "Java Invoke" activity or in a "Custom Function." Here's an example using the "Java Invoke" activity:1 - Create a process and insert a "Timer" activity, then transition to a "Java Invoke" activity.2- Select the "Java Invoke" activity and in the "General" tab, click on "New Class." 3 - In the "name" field of the new class editor, enter "GetNumberOfDaysFromGivenMonth", or another name of your choice, and click "Finish."4- The class editor will appear, but we won't make changes to it for now, so simply save the project.5- Return to the created process and go to the "Java Invoke" activity. Select the "General" tab, choose the "multiOutput" option, and set the input and output parameters as shown in the image below. Save the project.6- Return to the editor of the class "GetNumberOfDaysFromGivenMonth" and review the input and output parameters that have already been defined. The method getNumberOfDays() was also created.7- In the class editor, import the library "import java.time.YearMonth;". Inside the method, insert the logic to obtain the number of days in the month. You can remove the "import java.util.*;" as it will not be used. The code should look like the image below.8 - Save the changes you've made and return to the process. In the "General" tab of the activity, select and in the "Method" option, choose the "invoke()" method.9- Navigate to the "Input" tab and provide the desired month and year. In my test, I entered 02/2023. Execute the process and observe the result, as shown in the example image below.Best Regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now