Jump to content
  • Announcements

    • Gregg

      Looking for the wiki content?   12/20/2015

      Until I can transfer the wiki content over to the new Articles, you can find the old content here: http://www.greggsmith.net/wiki.
    • Gregg

      New site logo   01/06/2016

      A special thanks to brianshs for creating a new site logo!

Leaderboard


Popular Content

Showing most liked content since 12/29/2015 in all areas

  1. 3 points
    The following is a list of terms used in descussing different aspects of CA Service Desk Manager. Term Description $NX_ROOT refers to the installation directory of Service Desk
  2. 2 points
    Hi, You need to make two changes to cdtj's code. The factory should be alg and the IsCol should use persisitent_id. function zDrawAlg(value) { rs.data(alg_snap); } <PDM_MACRO name=lsWrite text="var alg_snap='';"> <PDM_MACRO name=lsWrite text=" <PDM_LIST ESC_STYLE=C FACTORY=alg WHERE=\"call_req_id = '@{list.persistent_id}'\" PREFIX=object>"> <PDM_MACRO name=lsWrite text=" var alg_type = '@{object.type.sym}';"> <PDM_MACRO name=lsWrite text=" var alg_time_stamp = '@{object.time_stamp}';"> <PDM_MACRO name=lsWrite text=" var alg_description = '@{object.description}';"> <PDM_MACRO name=lsWrite text=" var alg_analyst = '@{object.analyst.combo_name}';"> <PDM_MACRO name=lsWrite text=" alg_snap += alg_analyst + ' @ ' + alg_time_stamp + ' [' + alg_type + ']: ' + alg_description + '\n';"> <PDM_MACRO name=lsWrite text=" </PDM_LIST>"> <PDM_MACRO name=lsCol hdr="Activity" attr="persistent_id" fmtfunc=zDrawAlg sort=no> Conan
  3. 2 points
    Sounds like you just need to modify the Message Template. To find the particular Message Template: Go to the Administration tab, Notifications folder, Message Templates folder Click Show Filter button, click More... Enter the following into Additional Search Arguments (notify_msg_body LIKE '%0771251111%')
  4. 2 points
    We're back! And there have been some changes! What did NOT change? SDU is using the same forum software All forum content is intact All wiki content is (or soon will be) available under the Articles section The Articles section will be editable by users, like the wiki was Everyone's accounts, passwords, and content are all intact What DID change? The wiki interface is gone The forum software has been upgraded (7 years overdue!) Reputation system - you can "like" posts and other content Social Media - you can share content to many different social media sites The original layout/look of the site has been replaced with a standard template, in an effort to bring the site back online quickly Advertising - for the moment, the advertising has been removed New host - the site is now hosted by the makers of the forum software. This is more expensive, but should result in easier maintenance and timely software upgrades. What caused SDU to shut down in the first place? Okay, so a few weeks ago, the previous company hosting SDU suspended the account because someone found a way into my account and either both malware files throughout the file system as well as attach malware code to existing, legitimate files. We're talking over a thousand affected files in a sea of over 15,000 files. At first, it looked like a manageable set to review one at a time and fix/delete. However, I soon realized just how pervasive the damage was and realized it was not reasonable to fix everything. And the host would not reactivate the account until the malware had been removed. On top of that, my host account was about to renew for another 2 years' of service. I saw no easy way to get SDU back up and operational, so I decided to pull the plug. I did NOT want to do that, and hated to see all of that content just disappear. So, why is SDU back in business? Well, mainly because of you. In the weeks since shutting down SDU, I've received quite a few emails from you guys thanking us for hosting SDU, offering stories of how SDU has helped you in the past, and many, many offers to help bring the site back or at least make a copy of the content available. I decided to break out the defibrillator and see if I couldn't get find a way to revive SDU. This is the result! I hope you like it! Gregg
  5. 2 points
    it's a Christmas miracle! Many thanks!
  6. 2 points
    Overview CA does not provide a GUI supported method for creating or modifying Condition Macros or Action Macros. However, the function that these types of Macros provides can be crucial. This article explains the steps to take for creating new or editing existing. Keep in mind, CA does not support any changes to the default Action Macros or Condition Macros and will not support any that you create. It is also highly recommended that you never modify the defaults, but rather copy them and create your own custom ones. Procedures Step 1. Extract a Sample Macro The first step is to extract a macro from the system and use this as guide. Take note of the macro's name the enter the following command: pdm_extract -f "SELECT del,fragment,lock_object,ob_type,sym,type FROM Spell_Macro WHERE sym = 'sample macro name'" > yourfile.txt Step 2. Add Your Script Now that you have the sample macro extracted from the system, modify the contents of the 'fragment' column to suit your scripting needs. Remember to use \\0012 for your carriage returns and \ to cancel out the double quotes in your script. Also, be sure to change the value of the 'sym' column or your new macro will not be loaded. Step 3. Load New Macro Run the following command to load your new macro into the system: pdm_load -f yourfile.txt -i -v Step 4. Extract New Macro for Additional Changes Run the following command to extract your new macro if additional changes are required: pdm_extract -f "SELECT * FROM Spell_Macro WHERE sym = 'sample macro name'" > yournewfile.txt Step 5. Uploading Changes Run the following command to load your modified macro into the system: pdm_load -f yournewfile.txt -v Notice there is no -i this time. A -i is only used when "inserting" a new macro, not when editing an existing one.
  7. 1 point
    you need to know: - spel basics; - vanilla javascript, jquery basics. I have list of tasks like Approval, Implementation, User testing, etc. Then I have registered trigger for that tasks, once task switch status from WAIT to PEND, trigger fires some activity to change chg's status. Whole logic contains ~2000 lines of spel and js code.
  8. 1 point
    oh, if I misunderstood you and you want to predefine chg on your custom form you can use PRESET functionallity: // in URL: +PRESET=<attr_name>:<rel_attr> // example, where 12345 is id and z_chg is your attr name: +PRESET=z_chg:12345 // or if you want to predefine chg using chg_ref_num, where 54321 is ref num: +PRESET_REL=z_chg:chg.id:chg_ref_num:54321
  9. 1 point
    Hi Isaque, You need some coding at client side to update the combo options, based on category changing events. The code you developed will work only for saved tickets where current category is hardware.celular. Regards, Eduardo
  10. 1 point
    That works fine: function zClearProp() { if (location.href.indexOf('METHOD=copy_cr') > 0) { var i; //Maximum porperties for (i=0; i<=22; i++) { document.main_form.elements["SET.prop"+ i +".value"].value = ""; } } } ........ body class="detailro" onload="loadActions();zClearProp();" onunload="unloadActions()">
  11. 1 point
    hi, you need to add any search condition, example: /CAisd/pdmweb.exe?OP=SEARCH+FACTORY=cr+QBE.GE.id=0 - obvious condition: "id equal or greater than 0", will show results; /CAisd/pdmweb.exe?OP=SEARCH+FACTORY=cr - will show filter first.
  12. 1 point
    Hi, do you use spel code to apply changes? because I didn't find any inputs for status or other attrs in attached file. Anyway, I remembered a universal solution, which will navigate employee to initial form and will show update message. Here is a way how to achieve it: 1. Add variable to func: { var url=cfgCgi+ "?SID="+cfgSID+ "+FID="+fid_generator()+ "+FACTORY="+factory+ "+PERSID="+persid+ "+OP=UPDATE"+ "+ACTIVITY_LOG_TYPE="+type+ "+EDIT_HTMPL=detail_alg_edit.htmpl" + "+AUTO_OVERRIDE_LOCK=true" + "+KEEP.zBackHome=1"; display_new_page(url); } 2. Use variable in condition on detail_alg.htmpl, add this code where hidden inputs are located: <PDM_IF "$args.KEEP.zBackHome" == "1"> <INPUT TYPE=hidden NAME=HTMPL VALUE="home.htmpl"> <INPUT TYPE=hidden NAME=KEEP.HOME_ACTION VALUE="Z_SUCCESS"> </PDM_IF> 3. Variable HOME_ACTION within KEEP array will be passed to home.htpml, so you can display custom message depending on it, find PDM_LINK OP=SHOW_DETAIL on home.htmpl and update it in this way: <PDM_LINK OP="SHOW_DETAIL" PERSID="$args.persistent_id" onmouseover="window.status = "Open Issue ${args.ref_num}"; return true;" onmouseout="window.status = window.defaultStatus; return true;"> <PDM_IF "$args.KEEP.HOME_ACTION" == "Z_SUCCESS"> <span class="alertmsg portlet_body_text">Issue ${args.ref_num} was updated.</span> <PDM_ELSE> <span class="alertmsg portlet_body_text">Issue ${args.ref_num} was created.</span> </PDM_IF> </PDM_LINK>
  13. 1 point
    Hi, you can try to fetch values using PDM_LIST and then apply data to the field. Code could look like (not tested): function zDrawAlg(value) { rs.data(alg_snap); } <PDM_MACRO name=lsWrite text="var alg_snap='';"> <PDM_MACRO name=lsWrite text=" <PDM_LIST ESC_STYLE=C FACTORY=cr WHERE=\"call_req_id = '@{list.persistent_id}'\" PREFIX=object>"> <PDM_MACRO name=lsWrite text=" var alg_type = '@{object.type.sym}';"> <PDM_MACRO name=lsWrite text=" var alg_time_stamp = '@{object.time_stamp}';"> <PDM_MACRO name=lsWrite text=" var alg_description = '@{object.description}';"> <PDM_MACRO name=lsWrite text=" var alg_analyst = '@{object.analyst.combo_name}';"> <PDM_MACRO name=lsWrite text=" alg_snap += alg_analyst + ' @ ' + alg_time_stamp + ' [' + alg_type + ']: ' + alg_description + '\n';"> <PDM_MACRO name=lsWrite text=" </PDM_LIST>"> <PDM_MACRO name=lsCol hdr="Activity" attr="id" fmtfunc=zDrawAlg sort=no>
  14. 1 point
    Yes. First, you would have to create an Action macro for object type Change Order Workflow Task that would modify the chg.status value. Note that there is no OOTB method for creating/updating Action macros so you would need to use another approach like pdm_extract and pdm_userload (search for eamples on this forum to see how it is done).
  15. 1 point
    Hi Lindsay, I agree that code is only filtring input, but the most annoying thing I know, is when you click Submit button system throws an error that something filled wrong and let you manually update inputs... edited: ah, yeah, I forgot about validation. Rajesh, here is preSaveTrigger that should work: function preSaveTrigger() { obj = document.main_form.elements["SET.zProject"]; if (obj.value.match(/([A-Za-z]{3}[0-9]{7})/g)) return true; alert(obj.value + "didn't match ABC1234567 input mask!"); return false; } Regards, cdtj
  16. 1 point
    Class: @{call_req_id.affected_resource.class.type}
  17. 1 point
    try to define them as: @{call_req_id.properties.0.label} @{call_req_id.properties.0.value} @{call_req_id.properties.1.label} @{call_req_id.properties.1.value} OR @{properties.0.label} @{properties.0.value} @{properties.1.label} @{properties.1.value}
  18. 1 point
    Examine the Role (Admin tab, Security and Role Management, Role Management, Role List) and see what the Functional Access for that role is (it's probably set to Modify). Change it to View.
  19. 1 point
    Hi, im out of test env and can't check attributes, but I found over internet that ci_id is reference to CI's table from CI's log. I really could misunderstand your goal, are you want to show asset_num of CI which is defined as affected_resource? If yes, you can show it in this style: Configuration Item: @{call_req_id.affected_resource.name} Alt CI ID: @{call_req_id.affected_resource.asset_num}
  20. 1 point
    To disable Reopen tab in Tickets when ticket is auto close
  21. 1 point
    Have you configured the SDM Connection parameters in the /SDM/Configuration/SDM Dataset?
  22. 1 point
    Has anybody got to the bottom of this error message? I get it it our 12.6 instance and it's annoying....
  23. 1 point
    Can you explain why you're not using the default (OOB) Auto-Assignment from SDM ? How is you code different from the feature that is in SDM ?
  24. 1 point
    RESOLVED: Change the button code to: and the hidden input to: Apparently, "document.getElementById" is still supported while "document.main_form.elements" is deprecated?. I couldn't find a specific reference to the supported versions, 'Breeze
  25. 1 point
    This is not possible using existing insert_wf form, becuase on save it calls specified WebEngine operation, which don't handle any other attribtues than specified on form OOTB. Here is 2 ways: insert tasks using CREATE_NEW method; create your own WebEngine method and call it using existing customized form.
  26. 1 point
    msg[2] is a kind of system message and since spl is not documented who knows what it's meaning... to keep logs clear you can modify construction to: if (msg_error()) { for (i=0;i<msg_length();i++) { logf(ERROR, "CustReply > msg[%d]:%s", i, msg[i]); } } to display only error messages.
  27. 1 point
    Hi, you can't fetch data in survey this way, because survey isn't linket to ticket, try to use PDM_LIST macro to get tickets data: code will look like: <PDM_LIST prefix="list" factory="cr" where="persistent_id = '$ext_args.CNTXT_PERSID'"> var cr_ref_num = "$list.ref_num"; var cr_assignee = "$list.assignee.combo_name"; // etc... </PDM_LIST> alert(cr_ref_num); alert(cr_assignee);
  28. 1 point
    Hi, javascript function called detailRowHdr uses followed attributes : display name, colspan, requirement flag. You can use pure html in display name, for example : detailRowHdr("<a href=# style='color:#FFF' onclick='alert(\'hello wold!\')'>Hello world!</a>", 1, 0); PS: also this will work for detailSetRowData Regards, cdtj
  29. 1 point
    First, you will need an Action Macro for the Request/Incident/Problem Workflow Task object. Since you cannot create one from the interface I have attached one that you can import. Use the following command: pdm_load -v -i -f CR_WF_Act_Macro.txt Next, view the Request Area to which you want to apply this. On the Workflow tab, view the last task in the workflow. On the Behavior tab, view the Complete status. On the To Do tab, click Update Actions on True. Click the Search button. Move the (newly imported) macro "Set related Request/Incident/Problem Status = Resolved" to the right column and click OK. I suggest you try this in your test environment first. CR_WF_Act_Macro.txt
  30. 1 point
    Hi, you need to define AUDITLOG param to your attribute, here is KD how to perform this: http://www.ca.com/us/support/ca-support-online/product-content/knowledgebase-articles/tec616368.aspx Regards, cdtj
  31. 1 point
    Look at the recent topic answered by @redwards: You need to use the Web Screen Painter to add a new field on the 'alg' object instead of the 'call_req' object (as it's referenced in the topic I mentioned) - from the screenshot it looks like you want to add the checkbox on the Activity Log screen.
  32. 1 point
    Great Gregg and your team !.. Really SDU helps a lot for me and most of the people who are beginners to CA Service Desk. Have a wonderful year ahead and all the best..
  33. 1 point
    Welcome Back! ! ! Great to see, and here's to another long run. There was certainly goodwill over at CA Communities when users heard about this: https://communities.ca.com/community/ca-service-management/blog/2015/12/09/the-end-of-an-era-farewell-and-thank-you-servicedeskuserscom I'm always happy to point people here as a great resource. Kyle_R.
  34. 1 point
    Fantastic job Gregg!
  35. 1 point
    Well done sir. Many thanks for all your efforts.
  36. 1 point
    Thank you! This is a great Christmas present.
  37. 1 point
    Overview Auto-assignment is the functionality that is intended to automatically set the ticket Assignee based on various factors, such as End User Location, Workshift, and Analyst availability to name a few. The process flow below helps to understand the thought process behind the auto-assignment process. History This article was originally a wiki article created by Gityerfix in 2008.
  38. 1 point
    Hi All, Realy T5U3369 solved this problem. Open a case on Support
  39. 1 point
    Perhaps you could share with the forum (here or create a wiki).
  40. 1 point
    Look in the BOXI Universe under 'Resource/CMDB/Configuration Item Extended/Extension Tables' and you should find the Extension Table for the Family you're trying to report on. If the attributes you're looking for are default attributes (i.e. not site local or customized), then you should find them under the corresponding Extension Table folder (e.g. 'CI Enterprise Service').
  41. 1 point
    Ask CA Support for T5U3369, this could fix your LDAP import problem.
  42. 1 point
    The integration is configured thru a Configuration Policy on CA ITCM, all atributes has a short description that will help you on configure it. But if you are talking about use the discovered hardware by ITCM on CA SDM i suggest you to check the command "pdm_discimp" on SDM server, i'm not sure if pdm_discimp is the best option but.....
  43. 1 point
    I think, it was the "Use Stricter Rules?" parameter in Survey Template. Just check it.
  44. 1 point
    Here is a sample code: if (argID != 0) <PDM_MACRO name=button caption="Event History" func="show_evt('cnt', 'atev', argID)" hotkey_name="Event History" id="SHOW_EVT_HISTORY" width=0> <PDM_MACRO name=btnEndRow> </PDM_IF> <PDM_MACRO name=dtlStart scroll=true> // Custom BEGIN: add contact image <PDM_IF "$args.type.id" != "2308"> </script> <table width="90%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="150" align="center" > <img src="$CAisd/sitemods/img/imgFolder/generic.png" witdh="128" height="128" id="person_img" name="person_img" onerror="this.src='$CAisd/sitemods/img/marca/person.png';" /> <PDM_IF "$args.z_employee_id" != ""> <script type="text/javascript"> var zPhotoURL = "$args.z_employee_id"; var imgUrl = "$CAisd/sitemods/img/imgFolder/" + zPhotoURL + ".jpg"; document.getElementById('person_img').src = imgUrl; </script> </PDM_IF> </td> <td align="right" style="padding-right: 5px;"> <script type="text/javascript"> </PDM_IF> // CUSTOM END Some comments: * this is part of detail_cnt.htmpl, the CUSTOM BEGIN/END show the custom code, you'll find the position to add this code by the previous code section (look up for 'Event History' button and find the portion in the page). * it assumes there is a custom attribute (z_employee_id) that exists on the 'cnt' object and each photo of an employee exists in the $NX_ROOT/site/mods/www/wwwroot/images/imgFolder folder. If you can identify an user by other attribute (such as userid) then you can replace z_employee_id with this attribute in the code above. * the code checks if the user accessing the page is an Analyst, so the info is displayed only for them.
  45. 1 point
    I finally found a solution, so simple, sufficed install an agent on the remote server.
  46. 1 point
    You must provide a new site-defined trigger for your custom field to trigger activity based on updates. The syntax is as follows: This file has a command of the type, POST_CI val_fieldupdate_site(persistent_id, audit_userid, CHANGED_ONLY, zattr) 111 FILTER( EVENT("UPDATE") ); where zattr is your custom object. if you have more than one custom object, add them all separated by commas. This trigger is entered via Web Screen Painter's Schema Designer for table cr (Request), within Site-Defined Triggers under the Advanced tab. If you examine the file cr_site.mod under site\mods in your CA SDM installation, the comments will explain this in more detail. It will also show that this must be done for each custom object you wish to perform Activity logging on.
  47. 1 point
    I can see 2 ways of writing to your own table(s): 1) use HTMPL forms and java script: on your detail_alg.htmpl, add some logic that checks for a 'TR' type of activity, then somehow have another the detail_z_custom_table.htmpl file load in a hidden frame with the CREATE_NEW operand. You will need to find a way to submit that hidden frame as well. Disadvantages: - this logic will only work if the TR is done from the detail_alg form. Not if it's done by some web service, or automated event / other possibilites. - logic runs mainly on client side, so out of control (javascript must be enabled, ...) - that last part: 'submit the hidden frame' could be a tricky thing (you need to make sure it's been loaded, has all values populated, only then submit) TIP: in r12.5 I believe you can create your own server operations (like CREATE_NEW), so there could be an easier/more direct way to do it! Sadly enough, your new operations need to be coded in Spell code :s 2) change the behavior of Service Desk by Majic/Spell code: this is achieved by setting up a server side trigger (not a DB trigger) in a mod file. This trigger would specify that whenever a TR activity is being saved some other code needs to run as well. That other code is a Spell function that you put in a spl file. Disadvantages: - Spell code is unsupported by CA - Spell code is undocumented, so you're never sure it will not do anything else than what you assume it's doing If you don't have any experience with Spell coding, this might indeed be tricky because it's already one of the more complex adaptations one could do. Basically, you'd need to retrieve all your values (agent doing the transfer, previous assignee, new assignee, ...), then initiate a group leader, create a new object of your z_custom_table type, set its values, then check in everything. That's why I referenced to that Wiki, it has all this in it (I only put the major parts in here to keep it simple): alg::z_write_to_new_table(...) { uuid uuidOldAssignee; uuid uuidNewAssignee; uuid uuidAgent; // set your values... (not sure what we all have in alg, need to check if we can find out the old and new values of the assignee and how) uuidOldAssignee = ...; uuidNewAssignee = ...; uuidAgent = ...; send_wait(0, top_object(), "get_co_group"); if (msg_error()) { logf (ERROR, "Error %s: could not get group leader", msg[0]); return; } object group_leader; group_leader = msg[0]; send_wait(0, group_leader, "checkout", dob); if (msg_error() && msg[0] != "NO") { logf(ERROR, "Error %s: checkout failed", msg[0]); return; } object custom_record; send_wait( 0, top_object(), "call_attr", "z_custom_table", "get_new_dob", NULL, NULL, group_leader); if (msg_error()) { logf (ERROR, "Error %s: could not get new z_custom_table", msg[0]); return; } custom_record= msg[0]; custom_record.oldassignee= uuidOldAssignee; custom_record.newassignee = uuidNewAssignee; custom_record.transferringagent = uuidAgent; send_wait(0, group_leader, "checkin"); if (msg_error()) { logf(ERROR, "Error %s: checkin failed", msg[0]); send_wait(0, group_leader, "uncheck"); return; } } Your trigger (on the ALG object) would look something like: POST_VALIDATE z_write_to_new_table() 1001 FILTER(EVENT("INSERT") && type = 'TR' ); I hope this helps, it's not 100% complete but should explain already most of what you'll need...
  48. 1 point
    Hi. pdm_load can be quite a helpfull tool, if you know how it works. Of course, pdm_load can do updates and inserts based on one file. But you have to know, how the data must look like. The question is, how can pdm_load determine, if it has to do an update or an insert for one single data record. If your loadfile includes the "id" column, it's quite simple: If a record for a given id is found, pdm_load will do an update to that record, if the id is not found in the db, pdm_load will insert a new record with the given id. Fine so far, but normaly in real world, you want to import/update data from external sources, and these sources do not know any internal ServiceDesk id values. Therefor, CA has invent the so called secondary keys. One or many columns within the ServiceDesk Schema for a single table can be marked as a secondary key (S_KEY). Take a look at the file site/ddict.sch. Here you will find all tables and columns known by ServiceDesk, and also, which columns do have the S_KEY attribute set. If no id column is given in your loadfile, all secondary key fields must be specified in the load file. When pdm_load works on such a file, the secodary key values will be used to search in the DB for existing records. From that point of view, it would make sense, that there is a unique index over all secondary key fields, because these fields will be used to uniquely identify a record. But this is a different story. If a record is found, this record will be updated, if no record is found, a new record with a new id will be created with the given data. For example. You want to load Request Areas. The ServiceDesk Table name is Prob_Category. A look into the ddict.sch file shows you, that the sym field is a secondary key. If your loadfile looks like TABLE Prob_Category sym description del { "sw.office.word", "This is a software problem with word", "0" } and you would do just a "pdm_load -f yourfile.dat", pdm_load would insert this record if it doesn't find an existing record with the sym field equals to "sw.office.word", otherwise it would do an update on the existing record. Hope that helps a bit. Regards ..........mikelm
  49. 1 point
    Well, I'm not an expert on this, but I see two things: Your function doesn't correctly calculate your local time: I assume the following: * In your environment the function DATEPART(dw, ...) will give back a 1 for Sunday, a 2 for monday, and so on * Your DST starts on the second sunday in March at 02:00 and ends at first Sunday in November at 02:00 If this is right, your function should look like CREATE FUNCTION [dbo].[GetDateFromEpoch] ( @Seconds int, @ConvertToLocalTime bit ) RETURNS datetime AS BEGIN DECLARE @datLocalDateTime datetime if(@ConvertToLocalTime = 0) BEGIN SET @datLocalDateTime = dateadd(s, @Seconds, '1/1/1970') END ELSE BEGIN DECLARE @datToCheck datetime SET @datToCheck = dateadd(s, @Seconds, '1/1/1970') DECLARE @intYear integer DECLARE @strMar1 varchar(18) DECLARE @strNov1 varchar(18) DECLARE @DayOfTheWeek integer DECLARE @DateDifference integer DECLARE @datDSTStarts datetime DECLARE @datDSTEnds datetime DECLARE @intGMTOffset integer /* Calculate when DST begins for the year in question */ SET @intYear = DATEPART(yyyy, @datToCheck); SET @strMar1 = CONVERT(varchar(18), @intYear) + '0301 02:00:00'; SET @DayOfTheWeek = DATEPART(dw, @strMar1); /* Day March 1 falls on in that year */ if(@DayOfTheWeek = 1) BEGIN SET @DateDifference = 7 /* Sunday is 1st day of the month */ END else BEGIN SET @DateDifference = 15 - @DayOfTheWeek; /* # of days between that day and the 2nd Sunday ("the second Sunday in March ", i.e. when DST begins)*/ END SET @datDSTStarts = DATEADD(dd, @DateDifference, @strMar1); /* Calculate when DST is over for the year in question */ SET @strNov1 = CONVERT(varchar(18), @intYear) + '1101 02:00:00'; SET @DayOfTheWeek = DATEPART(dw, @strNov1); /* Day Nov 1 falls on in that year */ if(@DayOfTheWeek = 1) BEGIN SET @DateDifference = 0 /* Sunday is 1st day of the month */ END else BEGIN SET @DateDifference = 8 - @DayOfTheWeek; /* # of days between that day and the 2nd Sunday ("the second Sunday in March ", i.e. when DST begins)*/ END SET @datDSTEnds = DATEADD(dd, @DateDifference, @strNov1); /* Determine if the date in question is in DST or not */ IF @datToCheck BETWEEN @datDSTStarts AND @datDSTEnds BEGIN SET @intGMTOffset = -4 /* DST */ END ELSE BEGIN SET @intGMTOffset = -5 /* No DST */ END SET @datLocalDateTime = DATEADD(hh, @intGMTOffset, @datToCheck) END RETURN @datLocalDateTime ENDNot that much changes, just the line "SET @DateDifference = 7 /* Sunday is 1st day of the month */". Otherwise, if the first march is a sunday in the year in question, your dst will begin already on the first sunday of march and not on the second one. Secondly, in your report, you are using this function with different parameters. For open_date, you are allways passing a 1 as the "ConvertToLocalTime" value, for resolve_date a 0. Why? If you pass a 0 to this function, no DST adjustment and no UTC adjustment (your timezone) will be done, never. This is the reason, your resolve date is wrongly calculated. My assumption is, that it is wrong all the time, because you allways pass a 0 as the ConvertToLocalTime parameter. And your calculated date difference is also wrong, because of the 0. Suggestion: From my point of view, you should allways pass a 1 in the ConvertToLocalTime parameter when calling your function GetDateFromEpoch. Hope that helps Regards ........mikelm
  50. 1 point
    Hi, I resolved my problem with the following code in detail_chg: function z_validate_kostenstelle(field) { if (field.value.length < 14) { alert("Bitte 14 stellige Kostenstelle eintragen"); field.focus(); } } <PDM_MACRO NAME=dtlTextbox hdr=Kostenstelle attr="z_kostenstelle" size=20 evt="onBlur=\\\"z_validate_kostenstelle(this)\\\""> Kind regards Sebastian
×