Scenario run Last Business date of the month




Dear community,

I have just started using Dataiku and creating a couple of data models. 

I have used the automation scenario with simple by default settings offered by Dataiku. But now I would like to automate the run for one of my data models to run on a monthly basis for the Last Business date of the month.

 

Anyone on how I could achieve this?

 

Thank you!
Hi Pauline,


Assuming you are using DSS version 9, you can use "Time-based" trigger and set "Repeat every" to 1 month and see if any condition will meet your requirements in the "Run on" dropdown. Please note: depending on the day selected, you may have some additional "Run on" dropdown option. Like in my example below, I chose the last Friday of the month, and that option appeared in the dropdown.


![Screenshot 2021-04-09 at 09.07.36.png](https://community.dataiku.com/t5/image/serverpage/image-id/3140i8598A7FDC3C76323/image-size/large?v=v2&px=999 "Screenshot 2021-04-09 at 09.07.36.png")


Regarding your question to set up a trigger to run on the last business day of the month, there is no option available at the moment. However, you can utilise custom trigger and python code for such custom requirements. Please check an example I have created below:  
Screenshot:


![Screenshot 2021-04-09 at 11.02.52.png](https://community.dataiku.com/t5/image/serverpage/image-id/3141i5F287B33BFD93DF1/image-size/large?v=v2&px=999 "Screenshot 2021-04-09 at 11.02.52.png")


Code:


 



```
import pandas as pd
from datetime import datetime
#get today's date in YYYY-MM-DD format
todaystr = datetime.today().strftime("%Y-%m-%d")
s = pd.date_range(todaystr, periods=1, freq='BM')
df = pd.DataFrame(s, columns=['Date'])
#get last working day of the current month from created dataframe above
lastBDCMstr = df.iloc[0]['Date'].strftime("%Y-%m-%d")
if lastBDCMstr == todaystr:
    from dataiku.scenario import Trigger
    t = Trigger()
    t.fire()
```

 


  
Above I utilised pandas, but for sure, there are many other ways to do it.


I hope this helps.


Best,  
Vitaliy




[View solution in original post](/t5/Using-Dataiku-DSS/Scenario-run-Last-Business-date-of-the-month/m-p/15612#M6566)
[@najoua.abbaci](/u/najoua.abbaci)

mabye the flow can be adopted to following:

assign:

leftside: drresult (datatype: datarow)

right side:

dt\_datepv.asenumerable.orderby(function ( r ) datetime.parseexact(r(0).tostring.trim, “dd.mm.yyyy”, system.globalization.cultureinfo.currentuiculture.datetimeformat)).last()

so… [@whyyouandi](/u/whyyouandi)

[image] whyyouandi:

i want to append another column of data.

you can add a column with [add data column] activity.

<https://www.uipath.com/activities-guide/add-data-column>

[image] whyyouandi:

and then edit the scrap date per row.

and to add a value to a target column, ch… hi james,

as you already figured out, custom transactions does not support automatic instrumentations (xhr, fetch, resources) which means the user would have to start span and attach it to the transaction manually.

and yes by setting { managed: true } in the starttransaction option the transaction… hi

we can do that by defining a string variable in the very beginning of the process with assign activity or by defining that in variable panel in the studio at the bottom the window

but make sure that we are not assigning any value to that variable later across the workflow

if we assign later th… > 
> What attributes I have to attach to the CreatedDate and ModifiedDate properties to make them automatically populated by the server based on the above scenario?
> 
> 
> 


**Solution 1)**



```
namespace Joukyuu.Models
{
    public class Passage
    {
        public int PassageId { get; set; }
        public string Contents { get; set; }


        public DateTime CreatedDate { get; set; }
        public DateTime ModifiedDate { get; set; }

       public Passage()
       {          
         this.CreatedDate  = DateTime.UtcNow;
         this.ModifiedDate = DateTime.UtcNow;
       }
    }
}

```

and by edit you have to change/update it by your self!


**Solution 2)**


Custom attribute:



```
[SqlDefaultValue(DefaultValue = "getutcdate()")]
public DateTime CreatedDate { get; set; }

```

[Entity Framework 6 Code first Default value](https://stackoverflow.com/questions/19554050/entity-framework-6-code-first-default-value)


**Solution 3)**


with help of Computed:



```
[Required, DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime CreatedUtc { get; set; 


  "dbo.Products",
            c => new
                {
                    ProductId = c.Int(nullable: false, identity: true),
                    Name = c.String(),
                    CreatedUtc = c.DateTime(nullable: false, defaultValueSql: "GETUTCDATE()"),
                })
            .PrimaryKey(t => t.ProductId);

```

<https://andy.mehalick.com/2014/02/06/ef6-adding-a-created-datetime-column-automatically-with-code-first-migrations/>


**Solution 4)**
You can also do this with command interceptor by modifying manually the query.


**Solution 5)** 
Use Repository pattern to manage the data creation and set it by CreateNew 
This is my favour Solution!


<https://msdn.microsoft.com/en-us/library/ff649690.aspx>


**Solution 6)** 
just set it or get in in the UI or in your VM.







In **Entity Framework Core 1.0** easy:



```
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Passage>()
        .Property(b => b.CreatedDate )
        .HasDefaultValueSql("getdate()");
}

``` hello [@saurabhgupta](/u/saurabhgupta) :wave:

i’m afraid that the last updated column isn’t supported by our api at this time. this is because it’s calculated client side. you can see a list of these column types here - <https://monday.com/developers/v2#column-values-section-auto-calculated-column>

although the api do… as long as you write down the hierarchy manually, there’s certainly the possibility to simplify such transitive from implementations with a macro. [i’ve written one here, feel free to take a look.](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=337cce675aa28e99ac030ca783c1c155) going even further one could try to use procedural macros with global state that uses annotations on the… Hi, Really hard to work this out from your query but I suspect the answer would be a correlated sub query to find the latest appointment date.



https://www.geeksforgeeks.org/sql-correlated-subqueries/ straight through processing (stp) is the end-to-end automation of the trading processes both within and between buy and sell side institutions. in short, it is a vehicle to real-time stock/ trade processing in financial service industry, with a seamless integration of components and processes involved in the trading cycle starting from first request to buy/sell interest ending up to trading settlement and reporting. stp starts from the first capture of an order through to final settlement. it involves the seamless, electronic transfer of information to all parties involved in the trading cycle utilizing standardized information flows, technologies, and infrastructures. stp provides wired links for investment managers and ability to process trade without manual intervention and exception, thereby eliminating chances for human errors. in short, t+1 is the simple term for the process of clearing and settling a trade one day after the trade date. 

key elements in an stp strategy:

1. stp is about t+1

a typical securities firm's back office is characterized by multiple applications at various stages of their useful lives and not necessarily 'talking' with each other. therefore stp would come to mean:

• streamlining operational infrastructure (internal stp) 
• readying for connectivity with trade participants and matching utilities (external stp). 

2. stp is more than process automation

by definition stp envisages a seamless, automated and integrated transaction-processing environment. this cannot be achieved by just automating existing business processes. as is seen even in highly automated back offices, not all processes are at their most efficient due to duplication. also existing automation, in most cases, will not maximize overall business process efficiency. so it is not possible to crash processing time further by increasing automation.

3. stp should go beyond information technology solutions

an obvious corollary to the proposition that stp goes beyond mere process automation is that stp is not just an it issue. implementation of stp is driven by business considerations such as reduction in processing costs, improvement in data integrity and usage for decision-making.

4. stp has many applications in addition to cost saving

the benefits of stp are generally considered to be:

• reduction in costs, due to a reduction in process inefficiencies and release of manpower

• reduction of risk, due to more efficient settlement and reconciliation as well as reduced exposure period when the settlement cycle is compressed 

both of these contribute to the bottom line of the company, and the general tendency is to measure the success of stp initiatives based on this. however the real measure of success is its impact on the competitive position of the industry participant. cost is only one dimension of competitiveness. a well thought out stp strategy can aim to improve top line and margins. this could be in terms of: 

• improving service levels to customers 
• improving data or information usage efficiency 
• release of resources to more core functions 
• enhancing processing throughput.

the benefits of stp go beyond cost savings. it is a strategic imperative that enhances a firm's corporate performance and its competitiveness.

5. stp is useful for both trade and non-trade issues

stp is usually associated with the securities market trading cycle and this causes stp to be viewed only in the context of the trading process 'silo.'

however the concerns that stp seeks to address, such as inefficient processes and manual interventions, are equally prevalent in non-trade processes. for example, if an asset management firm improves its client record keeping process using stp, there are tangible business benefits both in terms of cost savings and improving service delivery.

6. stp should be constantly, continuously utilized

an stp initiative is not just a one time operational initiative. instead, it has to constantly align with strategic and tactical needs of business. central to the stp theme is the premise that stp objectives flow top down from business needs and eventually get translated to it spending.

7. the current environment is never adverse to stp strategies

the advantage of embarking on an elaborate stp exercise is in having control and direction over the whole implementation and thus efficiently planning and deploying resources. the flip side is the large budget commitments to be made and difficulty in measuring roi, given the scope, scale, interdependencies and long implementation period. in the current environment, it may be better to take an incremental approach by:

• conducting firm-wide analysis for all core processes 
• phasing out affected processes in two or three buckets 
• selecting critical processes that will provide maximum business impact in phase one. 

however, much hinges on careful and intelligent choice of target processes. again it is necessary to have a pan-organizational view to take care of consistency and related dependencies. 

a significant risk is that the sum of the individual (silo) savings or benefits will not equal the overall benefit, as there would still be bottlenecks in interfacing processes that have been excluded from scope. some of the advantages of an incremental approach are: 

• it can provide early and quick wins.
• with smaller outlays expected, it is easier to 'sell' internally to stakeholders while seeking funding 

• it de-risks the implementation by phasing out changes 
• it serves the interest of change management by gradually building organizational acceptance. hi david, thank you for question. these are called alerts, and show payments that have come into and out of your account. the cards you see should be dragged and dropped on the slideby grid in the row for that particular customer or supplier (it doesn't matter which date, as slideby will automatically move this to the correct incoming/outgoing payment date). please visit this page to learn more about alerts and how these can be matched to any invoices and estimates you have created.