Using Variables in a "Report Custom Functions"

Hi!
I created a custom function using Basic Syntax where I am trying to declare/use variables.  I keep getting syntax errors and don't know why.  Here is my code so far:
Function cdQSIPeriod () As String
YY = Year(CurrentDate)
MM = Month(CurrentDate)
If MM = 1 then
    MM = 12
    YY = YY - 1
else
    MM = MM - 1
cdQSIPeriod = String(MM)& String(YY)
End Function
Any help you can provide will be appreciated.

You need to add
dim YY as number
dim MM as number
HTH,
Carl

Similar Messages

  • Access Report Custom Functions from code

    Post Author: leedo
    CA Forum: .NET
    Hello,
    I am using VS2005 (VB) and was able to change formula text from within code using the "FormulaFieldDefinitions" object. However, I am having problems finding out how I can do the same to Report Custom Functions.  The reason I am doing all this is that I noticed during my Windows app is running the source of my .rpt file is thrown in the user "Local Settings\Temp" folder and all code is revealed by simply opening that file. Please help. ThanksLeedo

    Post Author: MJ@BOBJ
    CA Forum: .NET
    It looks like it is not possible to access the custom functions within a report using the CR .NET SDK.  However, to address the potential security issue that you may be concerned about, is this a Windows or ASP.NET application?  If this is an ASP.NET application, then you shouldn't have to worry about the security as the end-user (client) will not be able to access that folder since the rest of the web server is typically unaccessible by the client. 
    Another way to secure your reports is to use what we call "managed reporting" solutions such as Crystal Report Server or Business Objects Enterprise, which manages reports securely and your users are only allowed to access/see what you allow them to.  These solutions also provide public SDKs so you could incorporate the system into your own applications.  For more information, go to www.businessobjects.com/products.

  • Using variable coulmn name in sql function

    Hi there,
    I am not an expert with PL/SQL and I can not figure out how to use variable column names in my function.
    My function is:
    CREATE OR REPLACE FUNCTION RESET_TRIGGERS(aTrigger VARCHAR2) RETURN NUMBER IS
    TEMP_ID NUMBER;
    TEMP_USER_ID NUMBER;
    BEGIN
    SELECT 'LIMS.'||'$aTrigger'||'.NEXTVAL' INTO TEMP_ID FROM DUAL;
    SELECT 'LIMS.'||'$aTrigger'||'_USER.NEXTVAL' INTO TEMP_USER_ID FROM DUAL;
    IF TEMP_ID > TEMP_USER_ID THEN
    LOOP
    SELECT LIMS.SQ_U_FINALRESULT_USER.NEXTVAL INTO TEMP_USER_ID FROM DUAL;
    EXIT WHEN TEMP_USER_ID = TEMP_ID;
    END LOOP;
    ELSE
    WHILE TEMP_ID < TEMP_USER_ID LOOP
    SELECT LIMS.SQ_U_FINALRESULT.NEXTVAL INTO TEMP_ID FROM DUAL;
    END LOOP;
    END IF;
    COMMIT;
    RETURN (TEMP_ID);
    END;
    What I want is that I pass a seqencename with aTrigger and that two triggers will be equal if not.
    eg ifaTrigger = 'SQ_U_FINALRESULT'
    than I want the triggers LIMS.SQ_U_FINALRESULT and LIMS.SQ_U_FINALRESULT_USER to be set equal.
    The above function will not work, but what will?????
    I hope you can help me out!
    Cheers

    A very strange function indeed.
    But here is what I think he meant to do:
    SQL> create procedure reset_sequences
      2  ( p_sequence_name in  varchar2
      3  , p_nextval          out number
      4  )
      5  is
      6    l_nextval1 number;
      7    l_nextval2 number
      8    ;
      9    procedure reset_sequence_value
    10    ( p_sequence_name in varchar2
    11    , p_current_value in number
    12    , p_new_value     in number
    13    )
    14    is
    15      l_dummy number;
    16    begin
    17      execute immediate 'alter sequence ' || p_sequence_name || ' increment by ' || to_char(p_new_value-p_current_value);
    18      execute immediate 'select ' || p_sequence_name || '.nextval from dual' into l_dummy;
    19      execute immediate 'alter sequence ' || p_sequence_name || ' increment by 1';
    20    end reset_sequence_value
    21    ;
    22  begin
    23    execute immediate
    24      'select ' || p_sequence_name || '.nextval,' || p_sequence_name || '_user.nextval from dual'
    25    into l_nextval1, l_nextval2
    26    ;
    27    if l_nextval1 < l_nextval2
    28    then
    29      reset_sequence_value(p_sequence_name,l_nextval1,l_nextval2);
    30    end if
    31    ;
    32    if l_nextval1 > l_nextval2
    33    then
    34      reset_sequence_value(p_sequence_name || '_user',l_nextval2,l_nextval1);
    35    end if
    36    ;
    37    p_nextval := greatest(l_nextval1,l_nextval2)
    38    ;
    39  end reset_sequences;
    40  /
    Procedure is aangemaakt.
    SQL> show err
    Er zijn geen fouten.
    SQL> create sequence testseq start with 5 increment by 1
      2  /
    Reeks is aangemaakt.
    SQL> create sequence testseq_user start with 2 increment by 1
      2  /
    Reeks is aangemaakt.
    SQL> declare
      2    l_new_value number;
      3  begin
      4    reset_sequences('testseq',l_new_value);
      5    dbms_output.put_line(l_new_value);
      6  end;
      7  /
    5
    PL/SQL-procedure is geslaagd.
    SQL> select testseq.currval from dual
      2  /
                                   CURRVAL
                                         5
    1 rij is geselecteerd.
    SQL> select testseq_user.currval from dual
      2  /
                                   CURRVAL
                                         5
    1 rij is geselecteerd.Regards,
    Rob.

  • Query Stripping not working properly when using variable in the report

    We have issue with WEBI document that have query stripping enable.
    Once the query stripping enabled there is no data return in the report.
    We have investigate on the problem, the query stripping function are notable to retrieve objects that indirectly used in the report
    as we have
    many variable in the reports.
    Ex.
    Var1 = object1 + object2
    Var2 = Object3 + Object4
    Var3 = Var1 + Var2
    Var4 = Object1 + Object2 + Object3 + Object4
    If we use only Var3 in the report, the object1,2,3,and 4 will not be
    retrieve.
    But if we are using Var4 in the report, the object1,2,3,and 4 will be
    retrieve properly.
    Please let me know is it a by-design behavior, if yes please share points on it

    Hi Amit,
    Thank you for response, however i already had alook on that VIdeo and it tells us about the basic enabling of query stripping.
    But my question is when we have a Variable in a report which is dependent on the other two variables it gives me #error so is it by design or not.
    Regards,
    Abhinav

  • Trouble migrating Crystal Reports Custom Functions from BOXI R2 to BOXI 3.1

    I can't seem to migrate the custom functions from the custom function repository in my R2 environment to the 3.1 with FP 1.3 environment.
    When I migrate Crystal Reports using the Import Wizard, they all come over and they retain their custom functions, however, they don't bring over or create a new custom function repository. 
    When I do run the import wizard I have selected the repository radio button, but it does not have any affect .
    How can I migrate all of these custom functions without having to manually open up reports and placing them back into the repository on the new server?
    Thanks,
    Randy

    Hi,
    so if they are published to Rel.2 this looks different.
    Just to clarify it a bit more...these Files are no Datasources for Reports and Universes and your Users dont consume them via InfoView?!
    Whats the purpose for these Files? If they have none, you can de- select them in the UMT and dont migrate them (or better said move them cause you wont actually migrate .csv files). But if nobody touches them, you can move them with the UMT during daily business...how long it will take i cant estimate it. But 65GB for .CSV files is a huge amount.
    But you are correct, to move them from Rel.2 to BI4 you have to use the UMT.
    If you have the ressources and time i would recommend the following (Thats what i usually do with my customers):
    1. Setup a Machine (could be a VM) with the same OS and BOE Version (included SPs and FPs) as your production Rel.2
    2. Schedule a half day or day Downtime to copy the content 1:1 from the production Rel.2 to the VM Rel.2 with the IW or CMS DB Copy. Or do this after Business Hours.
    - With this Size of your FileStore i would recommend the CMS DB copy way.
    - Now you have a 1:1 Testing Environment of your Production Environment
    3. Use the UMT to migrate from your VM Rel.2 to your BI4 installation
    - Here you can see how long it takes
    - You can check if the UMT is capable for this 65GB transfer
    - Can sort out other possible issues
    - Do some other Testing
    After you did that you have a perfect estimation on how long the Migration will take and what for issues you are facing. With this information you can decide if you need a downtime or can do it after Business Hours f.e.
    Regards
    -Seb.

  • Use CustomFunctionController to add Repository Custom Function to a reportclientdocument

    <p class="ssiBODYCOPY">I would love to know how to add a Repository Custom Function to a reportclientdocument - If this is possible?<br />I need to know how to instantiate an object of type Custom Function from the enterprise repository or get a list of available custom functions. <br />The following code takes a "custom function object" from an existing report (which is a repository custom function) and I THINK adds it to the reportclientdocument - in fact the count of items in the customfunctioncontroller is 1 after I add the custom function but when I save the reportclientdocument they dissapear - I am not sure if I should be using ADD or INSERT method. I also was able use other controllers such as the DataDefController which works sucessfully. Please can someone help me figure out how to do this (btw where in CI_INFOOBJECTS is a custom function stored?)<br /><br />Thanks Nicole<br /><br />Dim rptClientDoc As ReportClientDocument<br />&#39;open the report<br />rptClientDoc = OpenReport("report1", ceInfoStore)<br /><br />Dim myCustomfunctions2 As CrystalDecisions.ReportAppServer.DataDefModel.CustomFunctions<br />Dim myCustomcontroller2 As CrystalDecisions.ReportAppServer.Controllers.CustomFunctionController<br />myCustomcontroller2 = rptClientDoc.CustomFunctionController()<br /><br />myCustomfunctions2 = myCustomcontroller2.GetCustomFunctions()<br />Dim cf As CustomFunction<br />cf = getfunction(ceInfoStore, ceSession) &#39; Gets valid custom function object in ANOTHER report<br />myCustomfunctions2.Add(cf)<br /><br /><br />Dim datacont As CrystalDecisions.ReportAppServer.Controllers.DataDefController<br />datacont = rptClientDoc.DataDefController<br />datacont.RecordFilterController.SetFormulaText("currentdate > month(testing)")<br /><br />SaveNewReport(ceInfoStore, rptClientDoc, "report1", "report2")</p>

    Hello Nicole
    please also use our diamond sample site to search for samples which might solve your problem.
    Your need would be in CE managed samples which we publish for JAVA and NET.
    Please use this link:
    https://boc.sdn.sap.com/
    Falk

  • Report custom function and repository custom function

    Hi Guru:
    We have some repository functions.
    When using them in the report, in design time, we will choose Add to report for the functions and then we could use it.
    Then the repository functions are updated, and I found the report function, which comes from the repository function, is not updated, I need to add the repository function to the report again to update it.
    As we will have more and more reports using the repository function, in the long run, is there a way to automatically update the report function from the repository for all the reports?
    Thanks.
    Eric

    From Crystal's online help:
    Repository objects that are used in a report and are connected to that report's repository can be updated automatically when opening the report in Crystal Reports. This behavior is controlled by an Options setting and is global for all reports.
    Note:    Objects that are used in a report but are disconnected from the repository are not automatically updated when the report is opened.
    To set the update option
    On the File menu, click Options.
    The Options dialog box appears.
    Click the Reporting tab.
    Select the Update Connected Repository Objects on Open check box.
    Click OK.
    If you don't want to use this global option, you can also update a report's repository objects by selecting the Update Repository Objects option on the Open dialog box for an individual report.
    Note:    When you open a report that contains a command that is stored in the repository, and you have specified that you want to Update Connected Repository Objects on Open, only the definition of the command is automatically refreshed; the data that the command returns is not updated until you click the Refresh button in the report.
    HTH,
    Carl

  • Use variable in user report ...

    hi all, once i create the query with variabel [%0] and [%1] and then i create the user report on saved query form. In report designer i want to display the value of [%0] and [%1] on the report on data field how can i do that ? and what is the use of textbox variabel number and edi box variable on datafilend properties. Thanks

    It is my understanding that you cannot print the user input variables in a report.  I believe that will be available in a future version, probably 2004.

  • Use variables to create a custom Closed Captioning option

    Hey,
    I have a click box and text caption. On click of the click box I want to display a text caption and then on all slides throughout a project want that text caption box to remain on each screen, but want the content in that box to change per screen.
    What's the best way to do this?

    It is possible to do this but it's a bit involved because it requires that you run a check ON Slide Enter of each slide to find out if the CC captions should be displayed.  And since those captions will be different objects on each slide, you'll need to set up  a different Conditional Advanced Action for each slide.  That's a lot of work just to replicate something that Captivate can do with its own CC text feature.
    Here's one way to do it:
    You place text captions that share the same style and size on each slide.  Each caption should have the appropriate CC text for the audio on that slide.
    Set up a variable to track whether the user has clicked the button to activate CC text, then set an Advanced Action to show the text caption on the slide where the user clicks this button.
    For all the other slides, you need a separate Conditional Advanced Action to be executed ON Slide Enter to check the value of this CC variable and then SHOW the CC text caption if the variable is set to TRUE.
    If you don't have too many slides in your project then this might be OK.  But if you have a longish project with dozens of slides, you're going to get to hate this pretty quick.

  • SIT on SSHR using custom function

    Dear Group,
    I am implementing SSHR for a customer, the customer needs to have some special request that need to be entered from SSHR then follow an approval path.
    So I have created a SIT and copy the original process using workflow and create a custom function in SSHR with different parameter for process and pCalledfrom.
    My problem is that the with I try to display my segment only it’s not getting displayed
    For example:
    SIT: XX_Ticket_Request
    Segments:
    No_Ticket_Request
    Ticket_Type
    In the personalization:
    In the segment field I wrote:
    XX_Ticket_Request|SEGMENT1| SEGMENT2| SEGMENT3|
    Nothing is displayed only start date and new date if I try to insert a new line the required segment are displayed.
    How I can display the required fields only. before insert mode.

    You need to use the name of the flex segments, not the columns, e.g.,:
    XX_Ticket_Request|No_Ticket_Request|Ticket_Type|
    Let us know if that works!

  • Custom Function

    I am trying to create a custom function to include in the Functions, and under the Custom Function I want to have the currency format: "cdCurrencyScalerChoice" which I found in the Crystal Report sample: "Order PRocessing Efficiency"
    Jack..

    I use CR XI, so this answer is based on that version.
    Select a formula and edit.
    Now that you are in the formula workshop, you should see "Report custom Functions" near the top of the list.
    You should be able to select, and copy the custom function ( be sure to note, if this is Visual Basic, or not )

  • User exit call customer function 002 is not getting trigerred

    Hi
    I am using the user exit call customer function 002 in the function module idoc_input_proact to trigger and idoc.my problem is that the user exit is not geting triggered.
    please help me gurus as this the last day for finishing thw work.
    regards,
    Asish dash

    it means tthat, u are applying a wrong exit in the pgm.
    try to once again search for the suitable exits for your program.
    try this:
    how to find the customer exits for a particular transaction
    check out the pgm in this thread:
    Re: Find User Exits
    regards,
    padma

  • How to use customer exit variable in the report

    Dear All,
    i want to use a standard customer exit variable in the report properties.
    In the Bex Query Designer right hand bottom you will find two buttons "Properties" and "Task". Click on task you will get different option. Choose properties from there and then select "variable sequence tab".
    I need to add a standard variable there. How can i achieve it?
    Appreciate your early help.

    You need to add variable to corresponding charctertic then you can get that varaible for sorting the sequence....
    If 0CUST is the varaible then you need to assign it 0CUSTOMER then 0CUST will be available for the sequence.
    Edited by: shanthi bhaskar on Apr 2, 2009 5:41 PM

  • How do you identify all reports using a specific custom function?

    Is there a way to identify all Crystal reports that use a specific custom function?  When we make changes to the function we need to re-attach the function to the existing reports, but we need to know what and where they are.
    We are using CRS XI.
    Thanks.

    duplicate - please do not post multiple times

  • How to use a variable value set from custom dll in dataset

    Hi,
    I've inherited a SSRS report that I need to add some functionality to.  I'm setting a variable, ADAuthorizations, from a custom dll 
    ADAuthorizations is a string of all AD groups a user is a member of and I need to use this as a filter in a dataset.  I've tried using this variable as shown in the query below but I'm getting an error "The expression used for the parameter 'Unit_Permissions"
    in the dataset "Unit_Permissions" includes a variable reference.  Variable values cannot be used in query parameter expressions."  Is there another way I should go about doing this?   
    = "SELECT UnitCode, UnitName " &
      "FROM dbo.VW_Unit_Permissions " &
      "WHERE UserId in (" & Variables!ADAuthorizations.Value & ")" &
      "ORDER BY UnitName "
    Thanks,
    Robert

    Please follow below steps,
    1. Create a custom code to get all the users in an array,
    Public Function getUserName() As String()
       dim Users(1) as string
       Users(0) = "user1"
       Users(1) = "user2"
    return Users
    End Function
    2. Create dataset using the below query,
    SELECT UnitCode, UnitName FROM dbo.VW_Unit_Permissions ORDER BY UnitName
    3. Add a parameter @User and set properties : (Datatype as text, Allow multiple values, Visible)
    Under "Available Values" select specify values and set the label and values as expression.
    =Code.getUserName()
    4. Similarly for "Default values" as
    =Code.getUserName()
    5. Go to tablix properties and select the filter tab and set the properties as below,
    - Select Expression "UserId" i.e =Fields!UserId.Value
    - Operator as "IN"
    - Value as =Parameters!User.Value
    6. Preview the report.
    Regards, RSingh

Maybe you are looking for

  • Adobe form not dispalying content in portal

    Hi Experts, We have one issue in Portal. One user clicked on UWL item in portal its opening subscreen as like behaviour. In subscreen adobe form its not displaying any content and its displaying only approve and reject buttons. we checked user browse

  • Database clone error

    Hi, I make a database clone. I copied all files from start database. After what I recreate controlfiles into the new database, and I have an error which I don't know what is it : Wed Jul 28 13:22:28 2004 CREATE CONTROLFILE SET DATABASE "IPUMAS" RESET

  • Required help in useradd script

    friends i need help in a script i want to creat a script that adds 50 users but there is a problem i dont know how to assigne the passwords to the users in the script if some body know's about this please give me usefull information. REGARDS. ASIf

  • Time slot proofs

    can anyone tell me why we using 51.2microseconds for time slots? or 512bit as the minimum frame size? i've tried to calculate that x=(2500*2(distance))/(2*10(8)) it get 25micsecond

  • I want to increase the range of the current that my program can measure.

    I have NI-DAQ 6024E and CB-68LP connector.I'm using pins 68 & 67 for input current that is to be measured.It somehow reads 20 mA when it's 200 and 30 mA when it's 300!! Also please tell me how can I increase the current range that can be read by this