Need to create a Default Value or WorkFlow with Time Expressions

There are numerous times where our people's targets are measured by week. Our weeks run from Monday through Sunday so we say "week ending" is on Sunday night at midnight. Each rep puts in calls, proposals, etc. but are measured on each weeks targets.
I was able to create an expression in analytics that would take the Created Date and look ahead to find that week's Sunday. I need to return that date and save it on the record itself to speed up retrieval as well as limit how many places/reports I need to perform this very common calculation. This will also allow the user to quick search their activities over a given week since it will be stored in an indexed date field.
Example: If today was Thursday 5/12/2011 then I would want the function to return 5/15/2011.
Here is how I solved it in Anaytics on a report which just looks at the DAYOFWEEK (1-7) to determine if it is a mon-sun and then figures out how many days to add to get me to the next Sunday.
TIMESTAMPADD(SQL_TSI_DAY, (8 - CASE WHEN DAYOFWEEK(CAST(Activity."Created Date" AS DATE)) = 1 THEN 8 ELSE DAYOFWEEK(CAST(Activity."Created Date" AS DATE)) END),CAST(Activity."Created Date" AS DATE))
How do I modify this so I can do the same thing with Expression Builder?

I tried the above expression and it wasn't getting me a guaranteed result. The date that I'm trying to convert is the actual "CREATED DATE" timestamp field. In some cases I was getting the correct date and in others I was getting one day less which breaks the calculations.
What I may not understand is how this will work and if time zones come into play at all. I need it to set the time to the Sunday MM/DD/YYYY 12:00 AM timestamp no matter what timezone they are in? I'm not sure if all of the reps even have their time zones set correctly. In some cases the date is correct but the time is set to 1:00AM/2:00AM/etc.
It may just be the time zones but I tried a different function as well just in case:
ToChar([<CreatedDate>] + (6 - IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") <=2, 1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") , IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 4, 3, IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 5, 4, IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 7, 5, IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 8, 6,-99)))))),"MM/DD/YYYY")
Basically (today + the number of days until Sunday) truncated to MM/DD/YYYY format which hopefully gets me a MM/DD/YYYY 12:00 AM format.

Similar Messages

  • How to create the default empty work book with company logo and address????

    Hi Guru's
    I am working in ECC5.0 (BW 3.5), i wann create the default empty work book with company logo and company address. so when i am executing any query's that should open in the default empty work book.
    greatly appreciated your help. will assign pt's for sure.
    thanks and regards
    Mohan

    Hi Mohan,
      Report designer is used in BI 7.It is a seperate application used for formatting
    the report.
    For BW3.5,go through this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/33/746e393cf65c1ae10000000a114084/frameset.htm
    This would help you
    Regards,
    Senoy

  • How to make the LV front panel controls the current value through the program is set as the default value when the next time you open?

    How to make the LV front panel controls the current value through the programis set as the default value when the next time you open?
    1110340051 

    Try this: Re: How to make a VI remember the latest control value?
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • How to create a default value of timestamp column?

    I am trying to create a table with a default value on a timestamp column, can it be done?
    CREATE TABLE myTbl
    FutureDateTime date default TIMESTAMP WITH TIME ZONE '2999-12-31 23:23:59.000'
    )

    user1035690 wrote:
    I am trying to create a table with a default value on a timestamp column, can it be done?
    CREATE TABLE myTbl
    FutureDateTime date default TIMESTAMP WITH TIME ZONE '2999-12-31 23:23:59.000'
    )Yes, but you don't have a timestamp column, you have a date column.
    CREATE TABLE myTbl
       FutureDateTime date default to_date('2999-12-31 23:23:59', 'yyyy-mm-dd hh24:mi:ss')
      4  );
    Table created.
    Elapsed: 00:00:00.09
    ME_XE?And just in case you weren't aware, storing "end of time" information like this will be rough on your queries (it skewes the cost based optimizers estimates for cardinalities and could wildly throw off the estimates for your queries, resulting in bad plans). You're better off to store NULL values, NULL denoting not known values.
    Just an FYI :)

  • ORA-01400 - not null column with default value and item with authorization

    I've searched - I would think someone has run into this. APEX 3.0.0.00.20 - I've created a simple form on a table. One of the column is a not null column with a default value. I have a select list on that item, but it has security on it - authorization scheme. So, it checks the user and if that user isn't of the right role, it will not even display that item. However, APEX appears to still send in the column in its sql! So, the default value is useless, it sends in null each time. Even if I set the default at the Item level, I get null. Argg. That's got to be a bug...
    In debug, I do not see the item listed at all. It's not used. That's fine - but why is it trying to insert the value? I would think it would leave it off??? I think because the item is associated with a database column. But, getting around this is ugly. Having to create a hidden item for each one, and then check to see if I need to take the list value... horrible. Any way to get around this???

    I should add - I guess I can always put my own custom process in to replace the DML. Just seems like a simple thing - if the value doesn't appear on the debug, isn't set with any default value... don't include it in the DML.

  • Set Default Values in Listbox with Dialog Programming

    Hi all,
    I am stuck with a problem i.e  I am working with Dialog Programming Screen
    where i have to set default values in some n numbers of Listbox which i have created on Screen.
    This default value is needed to be fetched from database table.
    I am using single table. Hence no confusion that i have to first fetch data from 1st listbox then corresponding data is fetched into second & so on ..NO NO This is not required.
    Simple one screen which will update a table in database, where  some fields on the screen needs to be default set as per tables domain default values set while table creation.
    Please help me out in this.
    Thanks & Regards,
    Sandhya.

    Please search SDN, before you post a new forum from next time... any ways just follow the below code..
    u need to use the FM 'VRM_SET_VALUES' to implement list box in module pool. Check the below code. u have to write this code in PBO..
    if c = 0.
    select land1 landx from t005t into table wi_country.
    sort wi_country by land1.
    delete adjacent duplicates from wi_country comparing all fields.
    loop at wi_country.
    wa_ctry-key = wi_country-land1.
    wa_ctry-text = wi_country-landx .
    append wa_ctry to wi_ctry.
    endloop.
    call function 'VRM_SET_VALUES'
    exporting
    id = 'ZCUST_MASTER1-COUNTRY'
    values = wi_ctry
    exceptions
    id_illegal_name = 1
    others = 2
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    c = 1.
    endif.
    Hope this helps u,
    Regards,
    Rajesh

  • Need to create a new row in table with same data as Primary key, but new PK

    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kale

    user9970447 wrote:
    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kalesomething like
    insert into mytable values ('literal for new pk',
                                           select non-pk-1,
                                                    non-pk-2,
                                                    non-pk-n
                                           from mytable
                                           where pk-col = 'literal for existing pk')

  • Need to create service order in one system with SO from other sys

    Hi,
    i need to create a DTO program to copy service order from one system to other system. Both systems are SAP systems.
    My requirement is to create service order with same number as it was in the existing system.
    Service order type : SM03
    Now standard SAP automatically create a service order of type SM03 when i add repair qty within the repair tab of IRPA line within a RAS order.
    Can you please let me know if there is a way by which i can change the service order number while creating it from a RAS order??
    Thanks,
    Willban

    Hi!
    In the customizing, you have to set its numbering to
    external in the receiver system for the SM03 order type. And of course you have to set its range the same, as in the sender system. 
    It's working fine here.
    Regards
    Tamá

  • Do I need an External Hard drive to Back up with Time machine?

         I probably have all kinds of misconceptions about Resetting to an earlier time for the computer I have. It's a 2009 macbook, running OS 10.8.5. I got it last week, previous to this machine I have been running a powerbook G4. It does not have a backup with Time Machine either.
    Let me tell you a funny story,
          Back in the year 2000 I got a powerbook G4, it was tops (in my Book) and my boss paid for it. David, my boss is the owner -operator of a manufacturing business turning out soft-weapons for martial artist's I call it the Chinese Stick Fighting Factory. <Sof-Stx.com> . While going to work one fine summer day on my Harley Super Glide,( I saw in my rear-view mirror that the back pack (packing the G4) had left the Vehicle with out authorization, and was bouncing down the road in the opposite direction. Anyway to make a long story short, I developed inoperable  Colon Cancer in 2008, I had to retire for the second time in my life, this time collecting a fixed income. and when I was able to fit it in my budget (in 2012) I got a used G4 and last week I got the MacBook running Maverick.
         So… any input ?

    Answer to your question....yes, buy an external HD. You do not need an expensive one and you do not need a huge one. I run two 500 GB externals - both attached (occasionally) to my MacBook Pro.
    Barry

  • How to create a default value for a JComboBox through his model

    Hi,
    I have created a "myComboBox" component.
    This component extend the standard Java JComboBox and simply add some helper features.
    The values that "myComboBox" display are coming from his bound model. (In fact, "myComboBox" has been designed to allow JComboBox to be implemented accordingly to the MVC design pattern: The model contains the data, the view the GUI and the controller handle the GUI events).
    My question is how can I add a default "none" item to the content displayed by an instance of "myComboBox" without doing any refactoring of the existing code implementing "myComboBox" ?
    Thank you very much for your help.

    It sounds like what you really want is to display "None" when the selected index = -1. Simple, write a custom list cell renderer that display's something instead of nothing when the index is -1.

  • I need to create a default profile that would install a home page and bookmarks for newly created users. It needs to be the same for Windows 7 and Ubuntu 12.04.

    Running a mix of Windows 7 Professional (64-bit) and Ubuntu 12.04 (32-bit). When a new user is created and logs in on either platform, I need that user to get a profile with a standard, predefined home page and set of bookmarks.

    Use a .cfg lock file and the Client Customisation Kit addon.
    * See instructions in http://kb.mozillazine.org/Locking_preferences
    * And use https://addons.mozilla.org/en-US/firefox/addon/cck/
    Does that help ?

  • Need help creating network of 1 Airport Extreme & 2 Airport Expresses!

    Please somebody help me! I've literally been trying to get our home network to function for months now. I'm seriously about to cry if i can't make it work.
    Here's the situation:
    Our apartment is long and narrow and probably has lead paint, so our wifi, powered by a brand new Airport Extreme Base Station 802.11n router (named Igor) connected to a comcast modem doesn't reach the whole house. So we got 2 Airport Expresses to place throughout the apartment (named Sven and Svetlana) to help boost the signal.
    First i tried to set up Igor to 'Create a wireless network" with the option 'allow this network to be extended' and the connection sharing set to 'Share a public IP' and i set up Sven and Svetlana to 'extend a wireless network' and the connection sharing was set to 'share a public IP'. Everything else was automatic or default pretty much. I got it to work but the connection was really weak and dropped out a lot.
    Then i tried setting up a WDS network. no luck there either. so i went to the apple store and they told me i had to hard wire them all together using ethernet cables (roaming network i guess) to compensate for the ****** network acoustics in our place.
    So...i ran 1 ethernet cable from Igor down the hall to Svetlana and another from Igor further down the hall to Sven. I set up all 3 to 'create a wireless network' and gave them all the same network name and password. i left the 'allow this network to be extended' option unchecked on all 3 and put them all in bridge mode and automatic settings for the radio mode and channel selection. After about 50 restarts i finally got it to work. Things seemed great for a minute until i realized that my laptop was the only one in the house that could connect to the internet. When i tried to troubleshoot the problem using network diagnostics and restarts, i eventually got my roommate's laptop to work but then mine stopped working.
    i've tried changing Igor's connection setting to share a public IP address and leaving Sven and Svetlana's in bridge mode. I've tried changing the 'configure IPv4' setting from 'using DHCP' to 'manual' and entering in identical info for all 3 in the TCP/IP section.
    no matter what i do i still have no idea how to make this work for multiple devices in our apartment. I really don't understand that much about networking but i am great at following directions. Please please please please help me! I'm desperate.
    thank you in advance for your help!
    ilana

    So...i ran 1 ethernet cable from Igor down the hall to Svetlana and another from Igor further down the hall to Sven. I set up all 3 to 'create a wireless network' and gave them all the same network name and password. i left the 'allow this network to be extended' option unchecked on all 3 and put them all in bridge mode and automatic settings for the radio mode and channel selection.
    In a "roaming" network, the router connected to the Internet modem should NOT be in bridge mode. In this case that would be your 802.11n AirPort Extreme Base Station (AEBSn). That is because you want it to provide both NAT & DHCP services to both AirPort Express Base Stations and the network clients.

  • Need to create new users in Office 365 with custom attributes from a csv file

    I am exporting users from an active directory environment and then deleting them from AD. They are Alumni and will no longer be in AD.
    I have a csv file with the following fields that I need to use to create new Alumni email boxes in Office 365 for. I need the CustomAttributes because my Dynamic Distribution Groups use them. I am fairly new to PowerShell and have been unable to get this
    to work. I suspect I may have to split it into two parts, but am not sure how to proceed. Any assistance would be appreciated. I was directed here from the Office 365 community.
    Import-Csv -Path c:\CSVfiles\CreateAlumni.csv | ForEach-Object {
       New-MsolUser -FirstName $_.FirstName -LastName $_.LastName
       -UserPrincipalName $_.UserPrincipalName
       -DisplayName "$($_.FirstName) $($_.LastName)"
       -Password $_.Password
       -CustomAttribute1 $_.CustomAttribute1
       -CustomAttribute3 $_.CustomAttribute3
       -CustomAttribute10 $_.CustomAttribute10
       -CustomAttribute11 $_.CustomAttribute11
       -CustomAttribute12 $_.CustomAttribute12
       -LicenseAssignment 'domaincom:EXCHANGESTANDARD_ALUMNI'
       -UsageLocation US

    Ok, it wasn't stopping after 2 iterations. What I was seeing was 2 failures. The first was the Get-Mailbox command and the second was when it tried to assign attributes. For some reason it is not looping when it fails. It just goes on and tries to assign
    the Custom Attributes. I added writes in to tell me what was happening.
    ### Check if mailbox is provisioned yet
    Write-Host "Checking if mailbox is provisioned yet..." -foregroundcolor yellow
    $found = $false
    $count = 0
    Do {
    try {
    Get-Mailbox -Identity $_.UserName -ErrorAction Stop
    $found = $true
    Write-Output 'Mailbox found. Details:'
    Get-Mailbox -Identity $_.UserName
    } catch {
    Write-Output 'Sleeping'
    $count++
    Start-Sleep -Seconds 5
    If ($count -ge 12) {
    Write-Output 'Mailbox not found. Quitting.'
    $found = $true
    } Until ($found)
    Write-Host "Adding Custom Attributes to User" -foregroundcolor yellow
    Set-Mailbox -Identity $_.UserName -CustomAttribute1 $_.CustomAttribute1 -CustomAttribute3 $_.CustomAttribute3 -CustomAttribute10 $_.CustomAttribute10 -CustomAttribute11 $_.CustomAttribute11 -CustomAttribute12 $_.CustomAttribute12
    Write-Output "User has been Provisioned in Office 365!" -foregroundcolor yellow
    Checking if mailbox is provisioned yet...
    The operation couldn't be performed because object 'Joe.Cool2003' couldn't be found on 'CO1PR07A002DC01.NAMPR07A002.prod.outlook.com'.
        + CategoryInfo         
    : NotSpecified: (:) [Get-Mailbox], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : [Server=CO1PR07MB125,RequestId=e1aabda1-01e4-4f68-984e-e20be0975242,TimeStamp=5/22/2014 4:23:59 AM] [FailureCategory=Cmdlet-ManagementObj
       ectNotFoundException] 2788FB48,Microsoft.Exchange.Management.RecipientTasks.GetMailbox
        + PSComputerName        : pod51038psh.outlook.com
    Mailbox found. Details:
    The operation couldn't be performed because object 'Joe.Cool2003' couldn't be found on 'CO1PR07A002DC01.NAMPR07A002.prod.outlook.com'.
        + CategoryInfo         
    : NotSpecified: (:) [Get-Mailbox], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : [Server=CO1PR07MB125,RequestId=16a8a2bc-333a-455c-8504-e0b99c44c334,TimeStamp=5/22/2014 4:24:00 AM] [FailureCategory=Cmdlet-ManagementObj
       ectNotFoundException] 2788FB48,Microsoft.Exchange.Management.RecipientTasks.GetMailbox
        + PSComputerName       
    : pod51038psh.outlook.com
    Adding Custom Attributes to User
    The operation couldn't be performed because object 'Joe.Cool2003' couldn't be found on 'CO1PR07A002DC01.NAMPR07A002.prod.outlook.com'.
        + CategoryInfo         
    : NotSpecified: (:) [Set-Mailbox], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : [Server=CO1PR07MB125,RequestId=8319d220-b9dd-492f-8182-5083cf56e58b,TimeStamp=5/22/2014 4:24:00 AM] [FailureCategory=Cmdlet-ManagementObj
       ectNotFoundException] C7844A24,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
        + PSComputerName       
    : pod51038psh.outlook.com
    User has been Provisioned in Office 365!
    Of course the user has been provisioned, but the CustomAttributes have not been assigned. :(

  • Want to create program which will trigger workflow with PDF attachement

    Hi Expert,
    I m new for work flow.
    I want to create abap program  which  trigger work flow with PDF attachment.
    Thanks in advanced.
    Regards,
    Laxman Sankhla.

    HI i have written code as per below.
    Now if i m running programe i m getting error  "Unable to create work item container
    (CL_SWF_RUN_WIM_FLOW->_IMPORT_CONTAINER) "
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER                = FP_FORMOUTPUT-PDF
        APPEND_TO_TABLE       = ' '
       IMPORTING
          OUTPUT_LENGTH         = ZVAR1
        TABLES
          BINARY_TAB            = IT_SOLIX_TAB.
      IF SY-SUBRC = 0 AND NOT IT_SOLIX_TAB[] IS INITIAL .
        SWC_SET_TABLE   CONTAINER 'IT_SOLIX_TAB'  IT_SOLIX_TAB.
        SWC_SET_ELEMENT CONTAINER 'ZVAR1' ZVAR1.
        SWC_SET_ELEMENT CONTAINER  'YBUS2012' OBJ.
        GV_INITIATOR = SY-UNAME.
        CALL FUNCTION 'SWW_WI_START_SIMPLE'
          EXPORTING
           CREATOR                            = GV_INITIATOR
          PRIORITY                           = SWFCO_NO_PRIO
            TASK                               = 'WS99900241'
           CALLED_IN_BACKGROUND               = 'X'
          TABLES
            AGENTS                             = IT_AGENTS
            WI_CONTAINER                       = CONTAINER.
        COMMIT WORK.
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Thanks in advanced
    Laxman Sankhla.

  • Creating or extending a wireless network with Extreme + Express?

    The range of my wireless internet at home is fairly poor using my Thomson TG784 wi-fi router. I have an Airport Extreme (802.11) and an Airport Express (both from 2007) that I want to use to extend its range. Using AirPort Utility to configure the Airport Extreme first, which of the following options do I want to select to set it up to do so:
    1) "Create a wireless network";
    2) "Connect to a network using Ethernet to extend the network or create a second network";
    3) "Join a wireless network";
    4) "Disable wireless and connect to a computer or network using Ethernet"
    If I connect the Extreme to my router, is it a problem if that router continues to transmit wirelessly simultaneously, or should it be configured not to transmit (if possible)? In other words, will the Extreme replace the wi-fi transmission of my router or will it extend it?
    Once the Extreme is set up, do I configure my Airport Express to 3) Join a wireless network?
    Thanks for any advice you can provide!

    You will need to connect the AirPort Extreme base station (AEBS) via Ethernet to your Thomson. Neither the AEBS nor the AirPort Express (AX) will wirelessly extend a network created by a Thomson device.
    You could use either option 1 or 2.
    Option 3 won't work for the AEBS since a non-Apple device is creating the wireless network.
    Option 4 does not make much sense for an AEBS. It does make sense for a Time Capsule.
    You basically want the AEBS to be configured to create a wireless network and as a bridge (not sharing a single IP address).
    If I connect the Extreme to my router, is it a problem if that router continues to transmit wirelessly simultaneously, or should it be configured not to transmit (if possible)?
    If you disable the router's wireless then you wouldn't be using the AEBS to extend the wireless network. You would simply be using the AEBS to create a wireless network.
    Once the Extreme is set up, do I configure my Airport Express to 3) Join a wireless network?
    You can. In that mode the AX will simply be another wireless client on your network. You can stream music to the AX or print to a USB printer connected to the AX.

Maybe you are looking for

  • How do two  ipod's use one computer to download itunes?

    New to ipod's/itunes.  Family member already has an itune account set up on my computer to download music.  Can I set up my own account on the same computer to share the itunes program?

  • Airplay does not show in windows 7 itunes

    I have been reading threads forever on the similar problem of users that noticed their airplay icon disappeared from windows itunes.  Is it me or has Apple lost the bubble on things?  Anyone have a flippin' clue how to get the airplay icon back so yo

  • Problem changing XML element in Adapter Module

    Hey! I am developing an adapter module to transform a coded password back to clear text. I have access to the XML element where the password is and I get to transform it, but I have 2 problems as also stated in the code: 1) I cannot set the new value

  • How can event driven scheduling will be acheived using DBMS_JOB

    Hi, I am running oracle jobs using DBMS_JOB package . I need to check for particular event is happend or not then only It should run my job.Can I acheive this using dbms_job.What is the syntax for it.Where Can i add dependencies in dbms_job Thanks

  • Underclocked cpu can it be made to run faster

    hi i read somewhere n8 has 772 mhz cpu underclocked is it possible to utilize the full  power of cpu most importantly will it  improveteh n8 xperience??? how will it effect battery life? except for n8 requiring charging everyday post anaa   i have no