SmartBlocks icon indicating copy to clipboard operation
SmartBlocks copied to clipboard

Generate multiple date based page links

Open TfTHacker opened this issue 5 years ago • 1 comments

✂️ Copy of your #42SmartBlock from Roam

  • #42SmartBlock Generate Date links for X days
    
    • <%SET:startingDate,<%INPUT:What is the starting date?%%Today%>%><%NOBLOCKOUTPUT%>
      
    • <%SET:howManyDays,<%INPUT:How many days to generate?%%5%>%><%NOBLOCKOUTPUT%>
      
    • <%JAVASCRIPT:```javascript
      roam42.sb.vars['dayCounter']=-1```%><%NOBLOCKOUTPUT%>
      
    • <%DATEBASIS:<%GET:startingDate%>%>
      
    • <%REPEAT:<%GET:howManyDays%>%><%DATE:in <%J:return roam42.sb.vars['dayCounter']+=1%> day%>
      
    • 
      

📋 Describe the SmartBlock

Generates multiple page links, but in the date format of Roam

✅ Describe any prerequisites or dependencies that are required for this SmartBlock

📷 Screenshot of your #42SmartBlock workflow/template from Roam

https://www.loom.com/share/76760b3e8ace49558f54446e892ba9a6

Video in Chinese https://www.loom.com/share/232f57b1fb4d4d6c90918bd4522bfea3

image

TfTHacker avatar Dec 26 '20 11:12 TfTHacker

Great explanation on how to generate a list of dates using SmartBlock! I added "How often?" portion to the equation to generate the list of dates for a specific date interval.

  • <%SET:startingDate,<%INPUT:What is the starting date?%%Today%>%><%NOBLOCKOUTPUT%>
    
  • <%SET:howOften,<%INPUT:How often do you want to review?%%5%>%><%NOBLOCKOUTPUT%>
    
  • <%SET:howManyTimes,<%INPUT:How many times to generate?%%5%>%><%NOBLOCKOUTPUT%>
    
  • <%JAVASCRIPT:
    ```javascript
    roam42.sb.vars['dayCounter'] = -1;```
    %><%NOBLOCKOUTPUT%>
    
  • <%DATEBASIS:<%GET:startingDate%>%>
    
  • <%REPEAT:<%GET:howManyTimes%>%><%DATE:in <%J:return roam42.sb.vars['dayCounter'] += Number(roam42.sb.vars['howOften']);
    %> day%>
    
  • <%CURSOR%>
    

gijigae avatar Dec 27 '20 04:12 gijigae