Calculate a result from a variable input

Hello,
I want to get a particular value for a characteristic when I run the query. I have a query that will return actual results for the month/year (MTD) that the user enters at the beginning. It will also show actual results for two months prior to the current month, budgeted values for current month, actual values for the year, budgeted values for the current year.
I want to calculate the number of patients from an invoice for the current month (MTD), and for all the other fields mentioned above. I want to restrict them to a particular code and their recipient ID. Do I have to write a customer exit and then include it in a formula variable? I’ve don’t have much experience in doing this. Any help would be greatly appreciated.
          Jul 2006     Aug 2006  Sept 2006  Sept 2006 Bud  YTD 2006 Act  YTD 2006 Bud
of patients
    Code A
    Code B
    Code C
I’m using a multiprovider and one of the cubes included is the Invoice cube.
Thanks
Sam

You could do this sort of thing:
REPORT znrw_calculator               MESSAGE-ID z1.
PARAMETERS: p_code1(20) LOWER CASE.
DATA t_source_tab(72) OCCURS 0 WITH HEADER LINE.
DATA g_program_name LIKE sy-repid.
DATA g_syntax_message(128).
DATA g_line_no TYPE i.
DATA var TYPE p.
AT SELECTION-SCREEN.
  PERFORM check_dynamic_abap.
START-OF-SELECTION.
  PERFORM do_the_business IN PROGRAM (g_program_name) CHANGING var .
  WRITE:/ p_code1 NO-GAP,'=' NO-GAP,var.
*&      Form  CHECK_DYNAMIC_ABAP
FORM check_dynamic_abap.
  DATA  t_abap(80) OCCURS 0 WITH HEADER LINE.
*set up a dynamic program
  REFRESH t_source_tab.
  APPEND 'REPORT'                            TO t_source_tab.
  APPEND sy-repid                            TO t_source_tab.
  APPEND '.'                                 TO t_source_tab.
  APPEND 'FORM do_the_business changing var type p.'   TO t_source_tab.
  APPEND 'var =' TO t_source_tab.
  append p_code1 to t_source_tab.
  APPEND '.' TO t_source_tab.
  APPEND 'ENDFORM.'                          TO t_source_tab.
*Generate the dynamic program so that the form can be used subsequently.
  GENERATE SUBROUTINE POOL t_source_tab NAME g_program_name
           MESSAGE g_syntax_message LINE g_line_no.
  IF sy-subrc <> 0.
    MESSAGE e999 WITH g_syntax_message.
  ENDIF.
ENDFORM.                         . "CHECK_DYNAMIC_ABAP

Similar Messages

  • Calculate Month Range from Single Month input

    Hi Gurus,
    In a particular query, the mandatory input is 0calmonth. Variable used is 0PCALMON.
    When user inputs 12.2007, then during runtime one of the keyfigure i need to calculate is quarter quantity for the month range 10.2007 to 12.2007 as 12.2007 falls in this quarter.
    Similarly if user inputs 03.2008, quarter quantity will be for these months 01.2008 to 03.2008.
    Plz tell me the steps from variable creation and writing code in cmod.
    Thanks in advance.
    Vaishnavi.

    Hi Jaya,
    I have written this code in cmod and activated.
    when 'ZMQ_RNG'.
    Data : ZYear(4) .
    Data : ZMon(2) type N .
    loop at i_t_var_range into loc_var_range
    where vnam = '0PCALMON'.
    clear l_s_range.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    ZYear = loc_var_range-low(4) .
    ZMon = loc_var_range-low+4(2) .
    If ( ZMon = '04' or ZMon = '05' or ZMon = '06' ) .
    l_s_range-high+4(3) = '06' .
    l_s_range-high(4) = ZYear .
    l_s_range-low+4(3) = '04' .
    l_s_range-low(4) = ZYear .
    Endif .
    If ( ZMon = '07' or ZMon = '08' or ZMon = '09' ) .
    l_s_range-high+4(3) = '09' .
    l_s_range-high(4) = ZYear .
    l_s_range-low+4(3) = '07' .
    l_s_range-low(4) = ZYear .
    Endif .
    If ( ZMon = '10' or ZMon = '11' or ZMon = '12' ) .
    l_s_range-high+4(3) = '012' .
    l_s_range-high(4) = ZYear .
    l_s_range-low+4(3) = '010' .
    l_s_range-low(4) = ZYear .
    Endif .
    If ( ZMon = '01' or ZMon = '02' or ZMon = '03' ) .
    l_s_range-high+4(3) = '03' .
    l_s_range-high(4) = ZYear .
    l_s_range-low+4(3) = '01' .
    l_s_range-low(4) = ZYear .
    Endif .
    append l_s_range to e_t_range.
    exit.
    endloop.
    ZMQ_RNG variable is customer exit, not ready for input, and mandatory field whereas oPcalmon variable is user entry, ready for input, mandatory.
    I have a RKF with 0CALMONTH restricted with ZMQ_RNG on quantity. free characteristics i have ocalmonth with variable 0pcalmon.
    Still my RKF doesnot calculate quantities for the 3 month range..
    Plz help.
    Rgrds,
    Vaishnavi

  • Result from 2 queries input to 3rd query

    Hi,
    We have requriement as follows, not sure how to go about this.
    We Need to build a workbook with 3 sheets wth 3 different queries. Once the workbook is open, we need to take documents numbers from query 1 and query 2 and input to variable of query 3 and execute query 3.
    Please help me understand how i can build this.
    Thanks
    AP

    You can try for APD option..
    .or else you can use some permuations on Replacement path variable..it will be able to solve your issue.
    another option is writing a Customer exit variable with manual entry enabled..here also you will have to load Report 1 and 2 data to some infoprovider.
    Regards,
    RK

  • Removing Key Date from variable input screen

    Hi Experts,
    I am trying to remove the "key date" entry from the variable input screen so users dont see this value when they are trying to run a query. Can you please advise me on how to do this?
    Thanks in advance.

    Hi Paul,
    You would need to open the query and remove this variable from the query definition, or if you need this variable and then remove the ready for input check mark from the variable definition.
    Hope this helps...

  • Input result from a SQL-query into a Variable in ProcessFlow

    I am trying to select a value from a table with file names.
    This file name should be input to an ftp function. I use a owb function to read the file name then I try to asign the result to a variable.
    The function GET_FILENAME looks like
    f_name varchar2(30);
    BEGIN
    select distinct FILENAME_SOURCE into f_name from CTL_SOURCE_FILES
    where FILEID = (select min(FILEID) from CTL_SOURCE_FILES where status is null);
    RETURN f_name;
    END;
    When running it as a SQL-script it returns only one row/name.
    When I am running it in the ProcessFlow the following message is found:
    RPE-02040: Internal error: GET_FILENAME cannot be converted to a constant value.

    Let me talk about this in context of a mapping:
    create a mapping :
    use a function within a mapping
    assign the output of the mapping to a mapping input variable"
    use this mapping within your process flow and see if it works.
    if you are directly going to use the output of a function in a process flow , the FTP should be able to accept the filename from the outparam of the function which i am not sure how it works.
    try using the first approach as it is relatively simple and straightforward.

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Two clicks required to get results from Search Input box on toolbar.

    I'm running version 8.02.208.
    I'm new at Webhelp and was hoping somebody might be able to give me some pointers.
    If I open my published webhelp on the Internet and try to search using the Search Input box on the toolbar the first time, two clicks are required in order to get search results.
    This problem only appears the first time, all other searches from the Search Input box on the toolbar work properly with only one click required.
    In addition, the Search tool opened from the Search button always works fine first and every time, but I did see the extra space that I've read about.
    This is what I don't understand...the problem I mentioned with the 2 clicks required on the toolbar, never happens when I Generate and View the results. Meaning that I am looking at the output but have not published it yet. It works fine first and every time.
    Why would the problem show up one way and not the other? Does anyone know what could be different?
    I just keep hoping that there is something that I can do to get rid of the problem. I keep getting Problem Reports opened and assigned to me and complaints from customer service from customers. They think the search isn't working and I keep having to explain.....arghhhh!
    Thanks!
    Deb

    Hi Sheryl and Peter,
    I have also tried the options as you have suggested without success. Everything works fine when the WebHelp is published to a local or network drive but when it is published to the server the issue occurs.
    I would point out too, that I find that the problem with the space only occurs on the intial attempt to search using the Search Box. Any subsequent attempts without closing the browser appear to work fine.
    Chris

  • Transformation not working on result  from oraext:query-database() functio

    Step 1: Create a project in Jdeveloper (File->New->Project->SOA Project)
    Step 2: Select synchronous process
    Step 3: Take the default schema for input and output
    Step 4: create a schema to hold multiple simple type string values.
    Step 5: Import that xsd file in the project wsdl file.
    Step6: Create a another variable (var1) referring the above element type (result)
    Step7: Drop an assign activity from component palette to the process between Receive and Replay activity
    Step 8: In the from section use the function oraext:query-database("select ename from emp",true(),true(),'jdbc/EBS_database').in the to section select the var1 variable.
    Step9: Drop another assign activity from component palette to the process before Replay activity and after the first assign activity
    Step 10: In from section select the first ename using xpath from var variable and assign to the output variable.
    Error: The value is not coming to the output from source(var) variable using xpath or transformation.

    See the audit trail on EM and verify why it is not working.
    Regards,
    Anuj

  • Variable input in Webi Report

    Hello Experts,
    I have a requirement to create a Webi report which has 3 key figure columns.
    While executing report It should ask for input variable fiscal year/period.
    Now 1st key figure colum should show Amount for the fiscal year/period I entered as an input variable.
    2nd column should show Amount for previous YTD for the fiscal year I entered.
    For Ex. if I enter 04.2009 it should show amount for 01.2009 - 04.2009 and if I enter 04.2008 then it should show amount for 01.2008-04.2008.(based on the variable input I provide)
    3rd column should provide the Amount <= ficsal period I enter as an input.
    Can anyone guide how would I achieve this?
    Regards,
    Nirav Shah

    Hi Nirav,
    what is the granularity of the time dimension of your data in your report? Generally you make sure that you fetch all required in your report and then use formulas (applying the if operator on the time field of your data and the value returned from your prompt) to calculate the desired key figures.
    Regards,
    Stratos

  • User defined methods as variable input

    Hello everyone.
    I'm reading through a teach yourself java programming guide and am a little confused about a couple things when it comes to variables and methods.
    I was wondering if it is "legal" to use a method as a variable input. Ex:
    variable = usermethod(num1, 23.43, 32.13); /* Assuming the variable and method parameters
    are of the same data type */
    I was also wondering if you can call a method as output to the stand output such as:
    System.out.println(usermethod(num1, 23.43, 32.13));
    I think that these are vaild uses but this book is not very clear on this point, it simply says that a user defined method is called from the method main and if it is a return type it will return a value. I assume that the returned value can be store in a variable using the syntax above, am I correct?

    Whenever the compiler sees a method name, it calls the method to get a return value from it. Both of those lines above are legal.
    You can use a method call pretty much anywhere you would put an expression; for example, if you had a function foo() which took an int, and you had another function bar() which returned an int, you could call foo() like this:
    foo(bar());Just make sure that methods you pass to other methods don't result in any unintended side-effects, such as printing to the screen.

  • Updating the result from Labveiw to Test stand!

    Hello, I
    have a quick question; i am using Labview 8.5 & Test Stand. I am
    develeoping Test Scripts using Labview for the design & using them in
    Teststand as PASS/FAIL tests. My question is when i run the tests in teststand
    its showing that the tests what i have written in labview has been passed but
    when i remove the connection to UUT & run the same its showing that tests
    are passed. Actually at this time it should show that the tests are failed
    since the connection to UUT is not present. But on the lab view window its showing
    the proper result(that the is failed due to to bad connection) but on the test
    stand window side its showing erroneous results i.e. tests are passed(i.e. the
    result is not being updated from lab view to test stand window). What should I  do  to
    update the result from lab veiw to testand . I have this problem from couple of
    days.
    Any help
    would be appreciated.
    Thanks.

    Hi basha,
    Looking at your Sequence File and the Pass / Fail Step in MainSequence.
    Although you have three connections on your VI FT_Open_Device_By_Sreial_Number.vi (one input, two outputs),
    within your step, you haven't connected them to any TestStand variables.
    I have attached the FileGlobals.Handle to the Handle output of your VI as an example.
    You need to do something similar for Device Serial Number and FT_Status.
    I am not sure where this top level vi comes in, are you hoping to replace FT_Open_Device_By_Sreial_Number.vi with this top level vi.
    If you are then you need to connect on input and output to its connector pane. I would suggest the boolean result is one of the ouptut
    Which you connect to Step.Result.Pass/Fail
    Regards
    Ray
    Message Edited by Ray Farmer on 03-10-2008 10:04 PM
    Regards
    Ray Farmer
    Attachments:
    vi.PNG ‏25 KB
    Specify Pass_Fail.PNG ‏24 KB
    top level.PNG ‏6 KB

  • ADFS SSO and SharePoint 2013 on-premise Hybrid outbound search results from SharePoint Online - does it work?

    Hi, 
    I want to setup an outpund hybrid search for SharePoint 2013 on-premise to SharePoint Online.
    But I'm not shure if this works with ADFS SSO.
    Has somebody experience with this setup?
    Here's my guide which I'm going to use for this installation:
    Introduction
    In this post I'll show you how to get search results from your SharePoint Online in your SharePoint 2013 on-premise search center.
    Requirements
    User synchronisation ActiveDirectory to Office 365 with DirSync
    DirSync password sync or ADFS SSO
    SharePoint Online
    SharePoint 2013 on-premise
    Enterprise Search service
    SharePoint Online Management Shell
    Instructions
    All configuration will be done either in the Search Administration of the Central Administration or in the PowerShell console of your on-premise SharePoint 2013 server.
    Set up Sever to Server Trust
    Export certificates
    To create a server to server trust we need two certificates.
    [certificate name].pfx: In order to replace the STS certificate, the certificate is needed in Personal Information Exchange (PFX) format including the private key.
    [certificate name].cer: In order to set up a trust with Office 365 and Windows Azure ACS, the certificate is needed in CER Base64 format.
    First launch the Internet Information Services (IIS) Manager
    Select your SharePoint web server and double-click Server Certificates
    In the Actions pane, click Create Self-Signed Certificate
    Enter a name for the certificate and save it with OK
    To export the new certificate in the Pfx format select it and click Export in the Actions pane
    Fill the fields and click OK Export to: C:\[certificate
    name].pfx Password: [password]
    Also we need to export the certificate in the CER Base64 format. For that purpose make a right-click on the certificate select it and click on View...
    Click the Details tab and then click Copy to File
    On the Welcome to the Certificate Export Wizard page, click Next
    On the Export Private Key page, click Next
    On the Export File Format page, click Base-64 encoded X.509 (.CER), and then click Next.
    As file name enter C:\[certificate
    name].cer and then click Next
    Finish the export
    Import the new STS (SharePoint Token Service) certificate
    Let's update the certificate on the STS. Configure and run the PowerShell script below on your SharePoint server.
    if(-not (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)){Add-PSSnapin "Microsoft.SharePoint.PowerShell"}
    # set the cerficates paths and password
    $PfxCertPath = "c:\[certificate name].pfx"
    $PfxCertPassword = "[password]"
    $X64CertPath = "c:\[certificate name].cer"
    # get the encrypted pfx certificate object
    $PfxCert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $PfxCertPath, $PfxCertPassword, 20
    # import it
    Set-SPSecurityTokenServiceConfig -ImportSigningCertificate $PfxCert
    Type Yes when prompted with the following message.
    You are about to change the signing certificate for the Security Token Service. Changing the certificate to an invalid, inaccessible or non-existent certificate will cause your SharePoint installation to stop functioning. Refer
    to the following article for instructions on how to change this certificate: http://go.microsoft.com/fwlink/?LinkID=178475. Are you
    sure, you want to continue?
    Restart IIS so STS picks up the new certificate.
    & iisreset
    & net stop SPTimerV4
    & net start SPTimerV4
    Now validate the certificate replacement by running several PowerShell commands and compare their outputs.
    # set the cerficates paths and password
    $PfxCertPath = "c:\[certificate name].pfx"
    $PfxCertPassword = "[password]"
    # get the encrypted pfx certificate object
    New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $PfxCertPath, $PfxCertPassword, 20
    # compare the output above with this output
    (Get-SPSecurityTokenServiceConfig).LocalLoginProvider.SigningCertificate
    [/code]
    ## Establish the server to server trust
    [code lang="ps"]
    if(-not (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)){Add-PSSnapin "Microsoft.SharePoint.PowerShell"}
    Import-Module MSOnline
    Import-Module MSOnlineExtended
    # set the cerficates paths and password
    $PfxCertPath = "c:\[certificate name].pfx"
    $PfxCertPassword = "[password]"
    $X64CertPath = "c:\[certificate name].cer"
    # set the onpremise domain that you added to Office 365
    $SPCN = "sharepoint.domain.com"
    # your onpremise SharePoint site url
    $SPSite="http://sharepoint"
    # don't change this value
    $SPOAppID="00000003-0000-0ff1-ce00-000000000000"
    # get the encrypted pfx certificate object
    $PfxCert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $PfxCertPath, $PfxCertPassword, 20
    # get the raw data
    $PfxCertBin = $PfxCert.GetRawCertData()
    # create a new certificate object
    $X64Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
    # import the base 64 encoded certificate
    $X64Cert.Import($X64CertPath)
    # get the raw data
    $X64CertBin = $X64Cert.GetRawCertData()
    # save base 64 string in variable
    $CredValue = [System.Convert]::ToBase64String($X64CertBin)
    # connect to office 3656
    Connect-MsolService
    # register the on-premise STS as service principal in Office 365
    # add a new service principal
    New-MsolServicePrincipalCredential -AppPrincipalId $SPOAppID -Type asymmetric -Usage Verify -Value $CredValue
    $MsolServicePrincipal = Get-MsolServicePrincipal -AppPrincipalId $SPOAppID
    $SPServicePrincipalNames = $MsolServicePrincipal.ServicePrincipalNames
    $SPServicePrincipalNames.Add("$SPOAppID/$SPCN")
    Set-MsolServicePrincipal -AppPrincipalId $SPOAppID -ServicePrincipalNames $SPServicePrincipalNames
    # get the online name identifier
    $MsolCompanyInformationID = (Get-MsolCompanyInformation).ObjectID
    $MsolServicePrincipalID = (Get-MsolServicePrincipal -ServicePrincipalName $SPOAppID).ObjectID
    $MsolNameIdentifier = "$MsolServicePrincipalID@$MsolCompanyInformationID"
    # establish the trust from on-premise with ACS (Azure Control Service)
    # add a new authenticatio realm
    $SPSite = Get-SPSite $SPSite
    $SPAppPrincipal = Register-SPAppPrincipal -site $SPSite.rootweb -nameIdentifier $MsolNameIdentifier -displayName "SharePoint Online"
    Set-SPAuthenticationRealm -realm $MsolServicePrincipalID
    # register the ACS application proxy and token issuer
    New-SPAzureAccessControlServiceApplicationProxy -Name "ACS" -MetadataServiceEndpointUri "https://accounts.accesscontrol.windows.net/metadata/json/1/" -DefaultProxyGroup
    New-SPTrustedSecurityTokenIssuer -MetadataEndpoint "https://accounts.accesscontrol.windows.net/metadata/json/1/" -IsTrustBroker -Name "ACS"
    Add a new result source
    To get search results from SharePoint Online we have to add a new result source. Run the following script in a PowerShell ISE session on your SharePoint 2013 on-premise server. Don't forget to update the settings region
    if(-not (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)){Add-PSSnapin "Microsoft.SharePoint.PowerShell"}
    # region settings
    $RemoteSharePointUrl = "http://[example].sharepoint.com"
    $ResultSourceName = "SharePoint Online"
    $QueryTransform = "{searchTerms}"
    $Provier = "SharePoint-Remoteanbieter"
    # region settings end
    $SPEnterpriseSearchServiceApplication = Get-SPEnterpriseSearchServiceApplication
    $FederationManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($SPEnterpriseSearchServiceApplication)
    $SPEnterpriseSearchOwner = Get-SPEnterpriseSearchOwner -Level Ssa
    $ResultSource = $FederationManager.GetSourceByName($ResultSourceName, $SPEnterpriseSearchOwner)
    if(!$ResultSource){
    Write-Host "Result source does not exist. Creating..."
    $ResultSource = $FederationManager.CreateSource($SPEnterpriseSearchOwner)
    $ResultSource.Name = $ResultSourceName
    $ResultSource.ProviderId = $FederationManager.ListProviders()[$Provier].Id
    $ResultSource.ConnectionUrlTemplate = $RemoteSharePointUrl
    $ResultSource.CreateQueryTransform($QueryTransform)
    $ResultSource.Commit()
    Add a new query rule
    In the Search Administration click on Query Rules
    Select Local SharePoint as Result Source
    Click New Query Rule
    Enter a Rule name f.g. Search results from SharePoint Online
    Expand the Context section
    Under Query is performed on these sources click on Add Source
    Select your SharePoint Online result source
    In the Query Conditions section click on Remove Condition
    In the Actions section click on Add Result Block
    As title enter Results for "{subjectTerms}" from SharePoint Online
    In the Search this Source dropdown select your SharePoint Online result source
    Select 3 in the Items dropdown
    Expand the Settings section and select "More" link goes to the following URL
    In the box below enter this Url https://[example].sharepoint.com/search/pages/results.aspx?k={subjectTerms}
    Select This block is always shown above core results and click the OK button
    Save the new query rule

    Hi  Janik,
    According to your description, my understanding is that you want to display hybrid search results in SharePoint Server 2013.
    For achieving your demand, please have a look at the article:
    http://technet.microsoft.com/en-us/library/dn197173(v=office.15).aspx
    If you are using single sign-on (SSO) authentication, it is important to test hybrid Search functionality by using federated user accounts. Native Office 365 user accounts and Active Directory Domain Services
    (AD DS) accounts that are not federated are not recognized by both directory services. Therefore, they cannot authenticate using SSO, and cannot be granted permissions to resources in both deployments. For more information, see Accounts
    needed for hybrid configuration and testing.
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • How to get save result from EXECUTE from a dynamic SQL query in another table?

    Hi everyone, 
    I have this query:
    declare @query varchar(max) = ''
    declare @par varchar(10)
    SELECT @par = col1 FROM Set
    declare @region varchar(50)
    SELECT @region = Region FROM Customer
    declare @key int
    SELECT @key = CustomerKey FROM Customer
    SET @query = 'SELECT CustomerKey FROM Customer where ' + @par + ' = '+ @key+ ' '
    EXECUTE (@query)
    With this query I want get col1 from SET and compare it to the column Region from Customer. I would like to get the matching CustomerKey for it.
    After execution it says commands are executed successfully. But I want to save the result from @query in another table. I looked it up and most people say to use sp_executesql. I tried a few constructions as sampled and I would always get this error: 
    Msg 214, Level 16, State 2, Procedure sp_executesql, Line 12
    Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.
    So the output should be a list of CustomerKeys in another table.
    How can I save the results from EXECUTE into a variable? Then I assume I can INSERT INTO - SELECT in another table. 
    Thanks

    CREATE TABLE Customer
    (CustomerKey INT , Name NVARCHAR(100));
    GO
    INSERT dbo.Customer
    VALUES ( 1, N'Sam' )
    GO
    DECLARE @query nvarchar(max) = ''
    declare @par varchar(10) = 'Name',
    @key varchar(10) = 'Sam'
    CREATE TABLE #temp ( CustomerKey INT );
    SET @query =
    insert #temp
    SELECT CustomerKey
    FROM Customer
    where ' + @par + ' = '''+ @key+ ''' '
    PRINT @query
    EXEC sp_executesql @query
    SELECT *
    FROM #temp
    DROP TABLE #temp;
    DROP TABLE dbo.Customer
    Cheers,
    Saeid Hasani
    Database Consultant
    Please feel free to contact me at [email protected] as well as on Twitter and Facebook.
    [My Writings on TechNet Wiki] [T-SQL Blog] [Curah!]
    [Twitter] [Facebook] [Email]

  • How can I make a row of cells containing 3-digit decimals, who's values resulted from calculations within the spreadsheet, appear as durations of minutes and seconds?

    Row 6 in this spreadsheet is the result of Row 2/Row 3 as evidenced by the formula listed while Cell Y6 selected. How can I make the values in this row appear as durations of minutes and seconds rather than 3-digit decimals? For example, rather than appearing as 9.84 I would like the value of Cell Y6 to appear as 9:50 or 9min 50sec. (obviously .84x60seconds 50 seconds). I tried changing the cell formats from "number" to "duration," but no change is made. Using the "duration" format does however work if I am manually entering the decimal value into the cell rather than allowing it to result from another caluclation within the spreadsheet. Is there a solution to this within Numbers '09? You can see why I would want the "pace" displayed in minutes and seconds. Thanks in advance!
    Ryan

    Hi Ryan,
    You wrote:
    "The problem is that my "Distance" is a row of automatically generated values resulting from ((Row1/60)*Row 6). Changing the format of Row 1 to minutes causes row two to be expressed as a duration, which obviously it shouldn't because it is a distance. The spreadsheet has to be designed so that all I have to manually input on each entry are Row 1 Values (Time) and Row 6 Values (Average Pace). The rest of the cells must be automatically poulated as a result of formulas."
    I'm assuming that where you say "Row 1" in this you mean "Row 2", which is labeled "Time" in the example in the OP.
    In the original post, you presented a formula from cell Y6. Replacing the Header labels in that formula's cell reference with the Addresses of the referenced cells, the formula was:
    Y6: =Y2/Y3
    In this post, you are saying that Y6 contains entered data: "...all I have to manually input on each entry are Row 1 Values (Time) and Row 6 Values (Average Pace).
    Which is correct?
    Regards,
    Barry

Maybe you are looking for

  • Adobe Photoshop 7 [editor] won't open for me.

    Hello, About a month ago I bought Adobe Photoshop elements 7.  I recently began using it, but when ever i try and open up the editor to edit my photo's, a message pops up.  It says: "Adobe Photoshop elements [editor] has encountered a problem and nee

  • Problem with picture synchronization in Outlook

    Hello. I have a problem with one of our users. We have a environment with Lync, SharePoint and Exchange.  One of our user changed his picture through SharePoint and from there it is synchronized with Active Directory. The sync between AD works fine.

  • Unit JHR is not created in language EN

    Dear All, While creating billing document getting error 'Unit JHR is not created in language EN'. I checked all MM data, we did not update JHR unit for materials still we get error. I checked JHR unit by using Transaction code 'CUNI'. JHR is availabl

  • Error in url for running forms

    Whenever I try to run a form on the web from Form Builder 9i (Patch 3), it generates a URL like http://%%20"http://strexler-us.us.oracle.com:8888/forms90/...&RENDER=YES" including the embedded " marks, etc. The page cannot be accessed unless I delete

  • ICal crashes after 10.6.3 update

    When I open iCal, it says updating calendars. Then hangs. Shows as "not responding" and I have to force quit. I've tried repairing permissions, trashing plist files for iCal, and reinstalling iCal. Nothing has worked.