trouble filtering left list

SOLVED

Hello,

Im trying to filter invoices left list based on two entry transactions.

Here is what I came up with:

$ACTION
#**************************************************************************************************************
    Case ACTION
        When "FILTRE"             :   Gosub ZFILTRE
	Endcase
Return

ZFILTRE
	If GUSER = "ADMIN" and GFONCTION1 = "GESSIH" Then
		Case GFLAG
			When "FC1" 
				CRITERE+= " [F:SIH]SIVTYP = 'FC'"
			When "FC2"
				CRITERE+= " [F:SIH]SIVTYP = 'RE'"
		Endcase		
	Endif
Return

It works well and the left list only displays invoices of the desired type.

the problem is that the selections no longer work:

 I can't add more filter in advanced selection, let's say [F:SIV]INVSTA=3 for example.
Only what is defined in SPESIH will be used.

To summarize, I would like to use SPESIH in order to add a filter to the existing selection rather than overwriting everything.
Is it possible ?

Thanks in advance for your precious help

  • +1
    verified answer

    Good day,

    As per the help file, rather make use of the FILGAUSUP(2) variable. The CRITERE variable is used when setting additional filters through the UI.

    $ACTION
    #**************************************************************************************************************
        Case ACTION
            When "FILTRE"             :   Gosub ZFILTRE
    	Endcase
    Return
    
    ZFILTRE
    	If GUSER = "ADMIN" and GFONCTION1 = "GESSIH" Then
    		Case GFLAG
    			When "FC1" 
    				FILGAUSUP(2) += "& [F:SIH]SIVTYP='FC'"
    			When "FC2"
    				FILGAUSUP(2) += "& [F:SIH]SIVTYP='RE'"
    		Endcase		
    	Endif
    Return

    online-help.sageerpx3.com/.../act_lisgauche.htm

  • 0 in reply to Regard Hulsbos

    Thank you for your help !

  • 0

    Hi, maybe you could try by setting CRITERE+=" & [F:SIH]SIVTYP='FC'"  just in case... I'm not sure

  • 0 in reply to Joaquin Vidal

    Hi thanks for your answer, actually I already tried that but it doesn't work:

    adding "&" in front of my critere seems to create an error

  • 0 in reply to Regard Hulsbos

    Hello again,

    I tried your solution but it doesn"t seems to work, sorry for the delay.

    Left list isn't filtered and when I check FILGAUSUP with the calculator, it's empty:

  • +1 in reply to N2XF3
    verified answer

    If you are using the CRITERE variable, you should perform an assignment and not include the "&" character (The "&" character is required when adding to the FILGAUSUP variable only, see the screenshot from the online help).

    Just out of curiosity, is there any other development on this folder? Remember that execution of code on any object is always SPE => SPV => SUB, thus if you have your code set in SPE but do not prevent the execution of the SPV or SUB code then the variables will get reset by the SUB code. 

    Given that your code is in the SPE and assuming you have no other development on this folder. You should change your code to the following: 

    $ACTION
    #**************************************************************************************************************
        Case ACTION
            When "FILTRE"             :   Gosub ZFILTRE
    	Endcase
    Return
    
    $ZFILTRE
        # CALL TO THE STANDARD
        Gosub FILTRE From SUBSOHA1
        [V]GPE = 1
        
    	If GUSER = "ADMIN" and GFONCTION1 = "GESSIH" Then
    		Case GFLAG
    			When "FC1" 
    				CRITERE = "[F:SIH]SIVTYP='FC'"
    			When "FC2"
    				CRITERE = "[F:SIH]SIVTYP='RE'"
    		Endcase		
    	Endif
    	
    Return