How to Customize powershell command to desired output

Hello,
By below command I got below output.  Please let me know how can I get User1102 get printed multiple times in each row along with Folder Name , FolderPath, ItemsInFolder, FolderSize
$bg = Get-Mailbox User1102
Get-MailboxFolderStatistics | FT $bg.Alias, Name, FolderPath, @{n= "FolderSize" ; e = {$_.FolderSize.Tobytes()}}
User1102                    Name                       
FolderPath                                ItemsInFolder                
FolderSize
                            Top of Information Store    /Top of Information Store                            
0                          0
                            Calendar                   
/Calendar                                            
4                       8055
                            Contacts                   
/Contacts                                            
2                        552
                            Conversation Action Sett... /Conversation Action Set...                          
0                          0
                            Deleted Items              
/Deleted Items                                        0                         
0
                            Drafts                     
/Drafts                                              
0                          0
                            Inbox                      
/Inbox                                              
10                      63897
                            Inbox01                    
/Inbox/Inbox01                                        1                     
57464
                            Journal                    
/Journal                                             
0                          0
                            Junk E-Mail                
/Junk E-Mail                                         
0                          0
                            News Feed                  
/News Feed                                           
0                          0
                            Notes                      
/Notes                                               
1                        396
                            Outbox                     
/Outbox                                              
0                          0
                            Quick Step Settings         /Quick Step Settings                                 
0                          0
                            RSS Feeds                  
/RSS Feeds                                           
0                          0
                            Sent Items                 
/Sent Items                                          
2                       7859
                            Suggested Contacts          /Suggested Contacts                                  
0                          0
                            Sync Issues                
/Sync Issues                                         
0                          0
                            Conflicts                  
/Sync Issues/Conflicts                                0                         
0
                            Local Failures              /Sync
Issues/Local Failures                           0                         
0
                            Server Failures             /Sync
Issues/Server Fail...                           0                         
0
                            Tasks                      
/Tasks                                               
1                       3542
                            Recoverable Items           /Recoverable Items                                   
0                          0
                            Deletions                  
/Deletions                                           
1                       3443
                            Purges                     
/Purges                                              
0                          0
                            Versions                   
/Versions                                            
0                          0

What is happening is that you are specifying User1102 as a property name via $bg.alias in the Format-Table an also Get-MailboxFolderStatistics is grabbing everything because you have not supplied a mailbox. Try this instead:
Get-Mailbox User1102 | Get-MailboxFolderStatistics |
FT Alias, Name, FolderPath, @{n= "FolderSize" ; e = {$_.FolderSize.Tobytes()}}
Boe Prox
Blog |
Twitter
PoshWSUS |
PoshPAIG | PoshChat |
PoshEventUI
PowerShell Deep Dives Book

Similar Messages

  • Combining 2 PowerShell Commands for One Output

    Folks, novice here and I am trying to combine the following commands into one output (if possible)...any guidance? Thanks!
    Get-ADUser -Filter 'teletexterminalidentifier -like "*"'|Select-Object name,teletexterminalidentifier|Export-Csv c:\profile_set1.csv
    Get-ADUser | select SamAccountName,Enabled | Out-File C:\AcctStatus.csv
    In other words, is there a way to pipe these into one command and one set of results (one file)?
    Thanks!

    Get-ADUser -LDAPFilter '(teletexterminalidentifier=*)'|
    Select-Object Name,SamAccountName,TeletexTerminalIdentifier,Enabled |
    Export-Csv c:\profile_set1.csv
    The LDAPFilter is concise and will be a much faster.
    ¯\_(ツ)_/¯

  • How to eliminate SQL command in Spool output?

    Hi,
    I'm trying to Spool an output to a txtfile without the SQL command being at the top of the page. I've tried a number of ways, but I'm having no luck.Any Ideas?
    Sorry for the long msg, but maybe if some saw what I'm trying to do it would be helpful.
    Many thanks,
    James
    Also does anyone know if its possible to import straight into Excel from PL/SQL?
    The following is the Script I'm running:
    set echo off
    set validate off
    set termout off
    set linesize 100
    set feedback off
    set verify off
    set heading off
    set serveroutput on;
    SPOOL C:/test12.txt
    spool on
    alter session set NLS_DATE_FORMAT='DD-Mon-YYYY';
    SET SERVEROUTPUT ON
    declare
    V_DATE_FILED      DATE;
    V_DATE_FILED_PREV     DATE;
    v_count_file_per_day     NUMBER(10) := 0;
    v_count_agents          NUMBER(10);
    v_count_farmers          NUMBER(10);
    v_count_total          NUMBER(10);
    V_AG_DATE_FILED      DATE;
    V_AG_DATE_FILED_PREV     DATE;
    v_AG_count_file_per_day     NUMBER(10) := 0;
    begin
    DBMS_OUTPUT.ENABLE(1000000);
    select count(*) into v_count_agents
    from TDSP_SAVED_DRAFT_DATA
    where syr_scheme_year_code =2007
    and SDD_FORM_TYPE=330
    and SDS_FORM_SUBMITTED_IND ='Y'
    and SDD_AUDIT_USER LIKE 'aga%';
    for rec in (select sph_sps_holding_id
    from TDSP_SAVED_DRAFT_DATA
    where syr_scheme_year_code =2007
    and SDD_FORM_TYPE=330
    and SDS_FORM_SUBMITTED_IND ='Y'
    and SDD_AUDIT_USER LIKE 'aga%'
    order by SDD_AUDIT_DATE)
    Loop
         select app.APP_DATE_OF_RECEIPT
         INTO V_AG_DATE_FILED
         from TDSP_APPLICATION app, TDSP_SAVED_DRAFT_DATA sdd
         where app.syr_scheme_year_code =2007
         and app.syr_scheme_year_code = sdd.syr_scheme_year_code
         and app.sph_sps_holding_id = sdd.sph_sps_holding_id
         and app.sph_sps_holding_id = rec.sph_sps_holding_id
         and sdd.SDD_FORM_TYPE=330
         and sdd.SDD_AUDIT_USER LIKE 'aga%'
         and rownum =1;
         if TO_CHAR(V_AG_DATE_FILED_PREV, 'dd/mm/yyyy') <> TO_CHAR(V_AG_DATE_FILED, 'dd/mm/yyyy') then
         DBMS_OUTPUT.PUT_LINE(V_AG_DATE_FILED_PREV || '/' || v_AG_count_file_per_day);
         v_AG_count_file_per_day          := 0;
         end if;
         V_AG_DATE_FILED_PREV := V_AG_DATE_FILED;
         if TO_CHAR(SYSDATE, 'dd/mm/yyyy') = TO_CHAR(V_AG_DATE_FILED, 'dd/mm/yyyy') then
         select count(*)
         INTO v_AG_count_file_per_day
         from TDSP_APPLICATION app, TDSP_SAVED_DRAFT_DATA sdd
         where app.syr_scheme_year_code =2007
         and app.syr_scheme_year_code = sdd.syr_scheme_year_code
         and app.sph_sps_holding_id = sdd.sph_sps_holding_id
         and sdd.SDD_FORM_TYPE=330
         and sdd.SDD_AUDIT_USER LIKE 'aga%'
         and TO_CHAR(app.APP_DATE_OF_RECEIPT, 'dd/mm/yyyy') = TO_CHAR(SYSDATE, 'dd/mm/yyyy');
         DBMS_OUTPUT.PUT_LINE(SYSDATE || '/' || v_AG_count_file_per_day);
         exit;
         end if;
    end loop;
    select count(*) into v_count_farmers     
    from TDSP_SAVED_DRAFT_DATA
    where syr_scheme_year_code =2007
    and SDD_FORM_TYPE=330
    and SDS_FORM_SUBMITTED_IND ='Y'
    and SDD_AUDIT_USER LIKE 'P%';
    for rec in (select sph_sps_holding_id
    from TDSP_SAVED_DRAFT_DATA
    where syr_scheme_year_code =2007
    and SDD_FORM_TYPE=330
    and SDS_FORM_SUBMITTED_IND ='Y'
    and SDD_AUDIT_USER LIKE 'P%'
    ORDER BY SDD_AUDIT_DATE)
    Loop
         select app.APP_DATE_OF_RECEIPT
         INTO V_DATE_FILED
         from TDSP_APPLICATION app, TDSP_SAVED_DRAFT_DATA sdd
         where app.syr_scheme_year_code =2007
         and app.syr_scheme_year_code = sdd.syr_scheme_year_code
         and app.sph_sps_holding_id = sdd.sph_sps_holding_id
         and app.sph_sps_holding_id = rec.sph_sps_holding_id
         and sdd.SDD_FORM_TYPE=330
         and sdd.SDD_AUDIT_USER LIKE 'P%'
         and rownum =1;
         if TO_CHAR(V_DATE_FILED_PREV, 'dd/mm/yyyy') <> TO_CHAR(V_DATE_FILED, 'dd/mm/yyyy') then
         DBMS_OUTPUT.PUT_LINE(V_DATE_FILED_PREV || '/' || v_count_file_per_day);
         v_count_file_per_day     := 0;
         end if;
         V_DATE_FILED_PREV := V_DATE_FILED;
         if TO_CHAR(SYSDATE, 'dd/mm/yyyy') = TO_CHAR(V_DATE_FILED, 'dd/mm/yyyy') then
         select count(*)
         INTO v_count_file_per_day
         from TDSP_APPLICATION app, TDSP_SAVED_DRAFT_DATA sdd
         where app.syr_scheme_year_code =2007
         and app.syr_scheme_year_code = sdd.syr_scheme_year_code
         and app.sph_sps_holding_id = sdd.sph_sps_holding_id
         and sdd.SDD_FORM_TYPE=330
         and sdd.SDD_AUDIT_USER LIKE 'P%'
         and TO_CHAR(app.APP_DATE_OF_RECEIPT, 'dd/mm/yyyy') = TO_CHAR(SYSDATE, 'dd/mm/yyyy');
         DBMS_OUTPUT.PUT_LINE(SYSDATE || '/' || v_count_file_per_day);
         exit;
         end if;
         end loop;
    end;
    spool off

    i use to use this kinda spooling..
    SET ECHO OFF
    SET FEEDBACK OFF
    SET HEADING OFF
    SET LINESIZE 32000
    SET PAGESIZE 0
    SET TERMOUT OFF
    SET TRIMSPOOL ON
    spool c:\test.csv
    PROMPT employeename,emp_id
    select employeename||','||emp_id
    from employees;
    SPOOL OFF
    SET ECHO ON
    SET FEEDBACK ON
    SET HEADING ON
    SET LINESIZE 80
    SET PAGESIZE 24
    SET TERMOUT ON
    SET TRIMSPOOL OFF
    to spool data into .csv file

  • How to add powershell script code in form application in C#

    Hi,
    i am creating a form application in C# and have powershell code which will create remote session on remote machine and execute few commands like set execution policy copy some share files install that files etc.
    I have to add this powershell script into form application in C#.
    Can some one please give me some example how to add the whole script which i have into C# code form application. Thanks in advance
    Thanks,

    Hi
    So the left is Run PowerShell Commands on Remote machine? Am I right ?
    Here  is a article talking about running  powershell commands on Remote Computers.
    http://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/
    About how to write in C#, please follow
    Joel Engineer's reply, using  process.Start() method  to start
    PowerShell.exe and Run PowerShell Commands to connect remote machine.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to run powershell in adminsitrator mode using invoke-command

    Hi,
    I'm trying to run the below script from the remote machine I'm getting the output as below and the msnpatch.exe is not getting executed on the remote machine(testserver).
    When I run the same command on the testserver, a new powershell session is getting opened and able to run msnpatch.exe.
    So, how to invoke powershell in runas administrator mode and run msnpatch.exe on that administrator window is my question.
    Thanks for your time. Your reply is highly appreciated.
    Script:
    Invoke-Command -ComputerName testserver -ScriptBlock {
    $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
    $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
    $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
    $newProcess.Verb = "runas"
    $newProcess.Arguments="-noprofile -command msnpatch.exe"
    [System.Diagnostics.Process]::Start($newProcess)
    Output:
    PS C:\Users\v-sridal> Invoke-Command -ComputerName 1f4-00073 -ScriptBlock{
    >> $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
    >> $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
    >> $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
    >> $newProcess.Verb = "runas"
    >> $newProcess.CreateNoWindow = "true"
    >> $newProcess.Arguments="-noprofile -command msnpatch.exe"
    >> [System.Diagnostics.Process]::Start($newProcess)
    >> }
    >>
    Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName                   
    PSComputerName
          4       4      244       1156     8     0.06   4968 powershell                    
    testserver

    There is no elevation when running remotely. UAC only affects local sessions. You cannot elevate a remote session.
    ¯\_(ツ)_/¯

  • How to customize CHM and PDF output

    I can easily generate CHM and PDF using the Generate Output option offered by DITA-FMx, but the output is just standard and I would like to customize it according to the company style. Which files should I work on to modify fonts, colours, indentation, etc, both for CHM and PDF?

    For PDF output, you should be using the Generate Book from Map command. This is one of the main reasons to use FrameMaker for DITA .. the high quality PDF output. You'll never achieve the same level of quality through XSL-FO as you do through native Frame. See this video for info on leveraging DITA-FMx features for PDF publishing ..
    http://blog.leximation.com/2010/03/pdf-publishing-with-dita-fmx-1-1/
    To customize the formatting of any output generated through the DITA Open Toolkit (which is what is used by the Generate Output command), you have to modify the XSL and CSS files in the DITA-OT. The "proper" way to do this is to create an OT plugin that provides you with a custom Ant target that does exactly what you want. You can then deliver this plugin to others on your team who need to generate the same output, and you haven't mucked around with the core OT files. You can also just dive in and tweak the files directly, but when you break something you won't be able to test with the original files without restoring from backups.
    You can start by tweaking the CSS files, but if you need to make structural modifications to the way the HTML is generated, you'll need to do some XSL work. Note that setting the @outputclass value on the DITA topic files, passes that value into the corresponding element in the @class attribute of the generated HTML. This is a good way to allow you to control formatting of specific elements.
    The best place to go for instructions/info on exactly which files to modify in the OT and how to build a plugin, is the dita-users Yahoo group. This is definitely the list to be on for anything that relates to the DITA-OT.
    Scriptorium Publishing has a nice whitepaper on customizing the OT ..
    http://store.scriptorium.com/items/books/hacking-the-dita-open-toolkit-detail.htm
    Also, the dita.xml.org website has some useful info.
    Cheers,
    ...scott

  • How to customize the Java Concurrent Program(PO Output for Communication)

    Hi,
    How to customize the Java Concurrent Program(PO Output for Communication)
    I need to add the Line level Ship To Address ,Line Notes and Extended Price fields on Java Concurrent Program.
    Please any body help/guide me in this regard.

    Hi,
    Changing Java Conc. program for "PO Output for Communication" is difficult.
    Actually, if you observe closely, "PO Output for Communication" program uses PO<HEADER/LINES..>_XML views.
    So if you could change these views and add your requireed columns to it, you can automatically see your changes in XML data file.
    See if the following link will you to get there.. http://chandramatta.blogspot.com/
    thanks,
    Matt

  • How to get Systemstate Backup size using PowerShell command in Windows 2008 R2

    Hi,
    We using WBSummary command to get completed backup status.
    I need to find how much data is backed up  using powerShell command .
    Is there any way to get the details , i can see the GUI but no in command.
    Please advise
    Regards Gopi K

    Hi,
    You mentioned that you can see the system state backup size in the GUI. Does the backup size mean the amount of date transferred?
    It seems that there is no such a PowerShell to get Systemstate Backup size. You may need to you need a PowerShell scripts to do this work.
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=ITCG
    Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • In [Process Bid Invitation], How to customize button[Output Preview]

    Hi,Guys
    Now, I need to display the window created by  my own SMARTFORM,while I push the button [Output Preview] .
    How to customize?
    Thank you.

    Hi,
    Create your own smartform via trx SMARTFORM.
    Then implement BADI BBP_CHG_SF_BID to switch from the standard smartform
    calling to the custom one. Just specify the custom smartform name in the BADI
    and activate the BADI.
    Please ensure, this Standard Smartform - BBP_BIDINV_BID gets called here.... Depending on your SRM System version
    Please try this Sample code.
    codemethod IF_EX_BBP_CHANGE_SF_BID~CHANGE_SMARTFORM .
    IF SMARTFORM = 'BBP_BIDINV_BID'. " Standard Smartform
    SMARTFORM = 'ZBBP_BIDINV_BID'. " Call your Customer Smart form
    endmethod.[/code]
    BR,
    Disha.
    Pls reward points for useful answers.

  • How to add user in administrator group of project server 2010 with powershell command ?

    I want to add one user in Administrator group of Project Server .
    Please let me know how to do this through power shell command.

    Hello,
    You would need to use the PSI in your PowerShell commands. Here is a .Net example to get you started, convert this to PowerShell:
    http://blogs.msdn.com/b/ajjose/archive/2013/05/24/creating-a-project-server-user-and-adding-user-to-a-group-through-psi.aspx
    Examples of PowerShell and the PSI can be found here in some of the scripts:
    http://gallery.technet.microsoft.com/scriptcenter/Update-Server-Lookup-table-bb1ae14f
    http://gallery.technet.microsoft.com/scriptcenter/Create-Server-2010-2013-19bd3cc7
    http://gallery.technet.microsoft.com/scriptcenter/Bulk-create-Server-Sites-784f7b29
    These wont do what you need but will give you an idea of using the PSI in PowerShell
    Paul
    Paul Mather | Twitter |
    http://pwmather.wordpress.com | CPS

  • How do I write a command in a .batch file written in NOTEPAD to run a powershell command?

    How do I write a command in a .batch file written in NOTEPAD to run a powershell command?
    Example:
    powershell -Command "& {Update-Help;}"
    would this be a correct command to put in a .batch file to update help information in powershell.
    All I want to know is how to write a windows powershell command in a .batch file.
    Multi-Commands
    Single-Commands
    Charles Wright

    Hi,
    You can separate multiple commands with a semicolon (;).
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How to Stop the powershell command execution in C#

    I am executing powershell command synchronously. Binded a eventhandler, which
    runs successfully when data is emitted by pipeline. When some condition met, i wish to stop powershell command execution,
    but when i call pipeLine.Stop(), program just hangs indefinitely. May i know what is going wrong?
    Command shellCommand = new Command("Get-MsolUser");
    Pipeline pipeLine = powerShellRunspace.CreatePipeline();
    pipeLine.Commands.Add(shellCommand);
    pipeLine.Input.Close();
    pipeLine.Output.DataReady += delegate(object sender,EventArgs args) {
    try {
    PipelineReader<PSObject> output = sender as PipelineReader<PSObject>;
    if (output != null) {
    bool isCompleted = false;
    while (output.Count > 0 && !isCompleted) {
    PSObject pso = (PSObject)output.Read();
    isCompleted = addDataDelegate(pso);
    if (isCompleted) {
    pipeLine.Stop(); //HANGS HERE
    log("JUST STOPPED PIPELINE..");
    } catch(Exception ex) {
    log(ex.ToString());
    pipeLine.Invoke();

    You may need to switch to InvokeAsync. I can't find any documentation on this, so it may come down to trial and error, but the synchronous Invoke method may not be playing well with attempts to call pipeLine.Stop().

  • How to set Full Crawl Schedule as None via Powershell command

    How to set Full Crawl Schedule as None via Powershell command

    $ssa = "Search Service Application"
    $contentSource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $ssa -Identity "Local SharePoint Sites"
    $contentSource.IncrementalCrawlSchedule = $null
    $contentSource.FullCrawlSchedule = $null
    $contentSource.Update()
    Basically you set Schedule to Null.
    Amit

  • Code for retrieving powershell command output

    Is there any scripting in java to get the output of powershell command.

    hello 
    please help me out
    I want to retrieve security eventlog with powershell command.but when ever run the powershell code I recieve the following error:
    Requested registry access is not allowed
    so that,I have searched  on the internet Days and nights .which I got from the Internet was change the Event log reader Group and change the
    followinfg registry key  and add read permission:
    KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
    Right click and Add Read permissions for Event Log Readers.
    in spite of the above task,i can not do that.
    any help would be appreciated

  • How to join to column details to get desired output

    Kindly refer the attached queries namely
    1)REORDER
    2)PENDING WORKORDER
    I want to calculate the work order requirement on basis of
    Stock, Pending sales order, re-order level and already entered workorders. Now i want to add the first column of 2nd query in the report of 1st query. For that i tried the below statements
    AND ITEM_CODE = LCS_ITEM_CODE (+)
    AND ITEM_CODE = SOI_ITEM_CODE (+)
    AND ITEM_CODE = PWH_ITEM_CODE (+)
    LCS_ITEM_CODE is Stock table item_code,
    SOI_ITEM_CODE is Sales order item_code,
    PWH_ITEM_CODE is Production work order item_code,
    When the above statments used while combining the 2 queries does display the result, but the details comes only for the ietm_codes whose work orders are present.
    Kindly guide me how can i get the desired output.
    1)RE-ORDER QUERY :
    SELECT DISTINCT ITEM_CODE,
    ITEM_NAME,
    (CASE
    WHEN SUBSTR(ITEM_CODE,11,3) = '000' THEN 'LOOSE'
    ELSE SUBSTR(ITEM_CODE,11,4)
    END) PKG_SIZE,
    ((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1) * TO_NUMBER(SUBSTR(ITEM_CODE,- 3,3))
    ||DECODE(SUBSTR(LCS_ITEM_CODE,11,3),'000',((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1)) STOCK,
    (CASE
    WHEN SUM(TO_NUMBER(SOI_QTY
    ||'.'
    ||SOI_QTY_LS) - (SOI_INVI_QTY_BU / IU_CONV_FACTOR / IU_MAX_LOOSE_1)) < 0 THEN 0
    ELSE SUM(TO_NUMBER(SOI_QTY
    ||'.'
    ||SOI_QTY_LS) - (SOI_INVI_QTY_BU / IU_CONV_FACTOR / IU_MAX_LOOSE_1))
    END) PNDG,
    ((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1) * TO_NUMBER(SUBSTR(ITEM_CODE,- 3,3))
    ||DECODE(SUBSTR(LCS_ITEM_CODE,11,3),'000',((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1)) - SUM(TO_NUMBER(SOI_QTY
    ||'.'
    ||SOI_QTY_LS) - (SOI_INVI_QTY_BU / IU_CONV_FACTOR / IU_MAX_LOOSE_1)) NETSTK,
    ITEM_RORD_LVL REORD_LVL,
    (CASE
    WHEN ((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1) * TO_NUMBER(SUBSTR(ITEM_CODE,- 3,3))
    ||DECODE(SUBSTR(LCS_ITEM_CODE,11,3),'000',((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1)) - SUM(TO_NUMBER(SOI_QTY
    ||'.'
    ||SOI_QTY_LS) - (SOI_INVI_QTY_BU / IU_CONV_FACTOR / IU_MAX_LOOSE_1)) > 0
    AND ITEM_RORD_LVL > 0 THEN ((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1) * TO_NUMBER(SUBSTR(ITEM_CODE,- 3,3))
    ||DECODE(SUBSTR(LCS_ITEM_CODE,11,3),'000',((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1)) - SUM(TO_NUMBER(SOI_QTY
    ||'.'
    ||SOI_QTY_LS) - (SOI_INVI_QTY_BU / IU_CONV_FACTOR / IU_MAX_LOOSE_1))
    ELSE NVL(ITEM_RORD_LVL,0) - (((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1) * TO_NUMBER(SUBSTR(ITEM_CODE,- 3,3))
    ||DECODE(SUBSTR(LCS_ITEM_CODE,11,3),'000',((LCS_STK_QTY_BU + LCS_RCVD_QTY_BU - LCS_ISSD_QTY_BU) / IU_MAX_LOOSE_1)) - SUM(TO_NUMBER(SOI_QTY
    ||'.'
    ||SOI_QTY_LS) - (SOI_INVI_QTY_BU / IU_CONV_FACTOR / IU_MAX_LOOSE_1)))
    END) REQ,
    DECODE(ITEM_RORD_QTY_LS,NULL,ITEM_RORD_QTY,
    (ITEM_RORD_QTY
    ||'.'
    ||ITEM_RORD_QTY_LS)) BTCHSZE
    FROM OM_ITEM,
    OT_SO_HEAD,
    OT_SO_ITEM,
    OM_ITEM_UOM,
    OS_LOCN_CURR_STK
    WHERE (ITEM_UOM_CODE = IU_UOM_CODE
    AND ITEM_CODE = IU_ITEM_CODE)
    AND ITEM_CODE = LCS_ITEM_CODE (+)
    AND ITEM_CODE = SOI_ITEM_CODE (+)
    AND LCS_LOCN_CODE = 'FG'
    AND LCS_ITEM_CODE = SOI_ITEM_CODE
    AND SOI_SOH_SYS_ID = SOH_SYS_ID
    AND SOH_TXN_CODE IN ('SORLLOC',
    'SORLCT3',
    'SORLNPL',
    'EXPFABLK')
    AND NVL(SOH_CLO_STATUS,0) = 0
    AND NVL(SOI_SHORT_CLO_STATUS,2) = 2
    GROUP BY ITEM_CODE,
    ITEM_NAME,
    LCS_STK_QTY_BU,
    LCS_RCVD_QTY_BU,
    LCS_ISSD_QTY_BU,
    IU_MAX_LOOSE_1,
    ITEM_RORD_LVL_LS,
    ITEM_RORD_LVL,
    ITEM_RORD_QTY_LS,
    ITEM_RORD_QTY,
    LCS_ITEM_CODE
    ORDER BY ITEM_CODE ASC
    2) WORK-ORDERS QUERY :
    SELECT DISTINCT PWH_NO PWO_NO,
    PWH_DT PWO_DT,
    (CASE
    WHEN PWFGPI_QTY = 0 THEN PWH_ITEM_CODE
    ELSE PWFGPI_ITEM_CODE
    END) ITEMCODE,
    ITEM_NAME PRODUCT_NAME,
    (CASE
    WHEN PWFGPI_QTY = 0 THEN SUM(PWH_QTY)
    ELSE PWFGPI_QTY * SUBSTR(PWFGPI_ITEM_CODE,11,3)
    END) PWO_QTY,
    PSD_PR_ACCP_QTY_BU / 1000 PROD_REP,
    PWH_PS_QTY_BU / 1000 PROD_SLIP_PENDING
    FROM OT_PWO_HEAD,
    OM_ITEM,
    OT_PWO_STAGE_DETAIL,
    OT_PWO_FG_PACKED_ITEM
    WHERE PWH_ITEM_CODE = ITEM_CODE
    AND PWFGPI_PWH_SYS_ID = PWH_SYS_ID
    AND NVL(PWH_CLO_STATUS,0) = 0
    AND PSD_PWH_SYS_ID = PWH_SYS_ID
    AND PWH_PS_QTY_BU / 1000 IS NULL
    GROUP BY PWH_NO,
    PWH_DT,
    PWH_ITEM_CODE,
    ITEM_NAME,
    PWFGPI_ITEM_CODE,
    PWFGPI_QTY,
    PSD_PR_ACCP_QTY_BU,
    PWH_PS_QTY_BU,
    ITEM_CODE
    ORDER BY PWH_NO

    That's a big query.
    Can I point out that
                    (CASE
                        WHEN SUM (  TO_NUMBER (soi_qty || '.' || soi_qty_ls)
                                  - (  soi_invi_qty_bu
                                     / iu_conv_factor
                                     / iu_max_loose_1
                                 ) < 0
                           THEN 0
                        ELSE SUM (  TO_NUMBER (soi_qty || '.' || soi_qty_ls)
                                  - (  soi_invi_qty_bu
                                     / iu_conv_factor
                                     / iu_max_loose_1
                     ENDis just
                    GREATEST(0, SUM (  TO_NUMBER (soi_qty || '.' || soi_qty_ls)
                                  - (  soi_invi_qty_bu
                                     / iu_conv_factor
                                     / iu_max_loose_1
                                    )and
                    DECODE (item_rord_qty_ls,
                            NULL, item_rord_qty,
                            (item_rord_qty || '.' || item_rord_qty_ls
                           )is just
    RTRIM (item_rord_qty || '.' || item_rord_qty_ls,'.')

Maybe you are looking for

  • Upgraded MBPro hard drive, can't boot from hdd or dvd

    Hey all, I got my mid-2010 15" Macbook Pro back from the Apple store a few days ago (they had replaced a faulty logic board). As the repair forced me to back up my data, I decided it was a good time to upgrade the size of my hard drive. I slapped a b

  • Best ISP for iMac/Macbook e-mail?

    I already have a G4 iMac and have a new (so far unopened) MacBook. I want to change my ISP from Demon to something less expensive and more adaptable. I haven't opened up the MacBook yet because I want to start from an ISP that's already in place.Any

  • Tax jurisdiction code in the billing document

    Dear All, How can I introduce tax jurisdiction code in the billing document of SD module?? Please help me. Thanks in advance

  • IPhoto '11 Cannot Export Photos

    Noticed tonight that I cannot export any photos. When i select the photo and select export, nothing happens. No messages or errors. No photos. Any ideas?

  • Is there a alternative for 'report on reports' ??

    Hi, Oracle9i Reports no longer supports opening or saving reports to the database so i can't create a ducumentation for my reports is there a solution thank's