Simplicty and flexibility!


GetFileName problem


Started by afonso santos
Search
You will need to Sign In to be able to add or comment on the forum!

GetFileName problem

Dear All,

I've two tables and each one has a button.

Table #1 , Button 1

Action:

Execute Function/Derivation

SetValue("path_Imagem",GetFileName("","",GetCurrent(GetVAr("pathImagens")))))

Table #2 , Button 2

Action:

Execute Function/Derivation

SetValue("path_Documents",GetFileName("","",GetCurrent(GetVAr("pathDocuments")))))

Both variables "pathImagens" and "pathDocuments" are assigned to a different path with SetVAr Function at the initial display of apllication, as follows:

SG := SetVar ( "pathDocumentos" , Path_Documentos ) .

SG := SetVar ( "pathImagens" , Path_Imagens ) .

The problem with  these instructions on each button is that they don't open the right folder.

To get the correct folder I need to choose it manually . Then, that path stay fixed .

Example:

When I press button #1  I should targeted to folder with images. But, if for some reason I have previously chosen the folder documents the application open the window with the folder of documents and not the images. The opposite is also valid.

Any idea what is wrong with this ?

Thanks

Afonso


Written by afonso santos 16/05/15 at 09:01:31 Dataease [{8}]FIVE

Re:GetFileName problem

A small sample that showcase the problem is necessary for us to spend the time to look into it, it is so many possible sources for error that it is a waste of time for us to try to replicate the problem based on just a small part of the environment.

Please remember to ALWAYS include a small app that specifically showcase the problem and nothing else.

This problem can be anything for a misspelling to a missing \ or and extra \ etc. We need to see the "not working" code to be able to make a call.


Written by DataEase 16/05/15 at 10:22:15 Dataease [{8}]FIVE

Re:Re:GetFileName problem

Download: producao_forum.zip

Please check this example:

table t_entrada_principal - start here in order to initializing variable paths

table t_parametros_sistema where we can define the folder's path

table t_teste with 2 buttons one for each folder

thanks

AS


Written by afonso santos 16/05/15 at 12:06:48 Dataease [{8}]FIVE

Re:Re:Re:GetFileName problem

Hallo Afonso,

did you also checked the rigth names e.g. Objeknames and Fieldnames ! Or maybe the writing of the Variabels in the scripts.

An option e.g. to check step by step to lokate the problem..... ;)

Good luck....

Markus


Written by grohmann.papier@t-online.de 16/05/15 at 12:56:02 Dataease [{8}]FIVE

Re:Re:Re:Re:GetFileName problem

All verified. Problem still happening

Thanks

AS


Written by afonso santos 16/05/15 at 14:26:16 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:GetFileName problem

Problem is that you confuse two different functions:

GetCurrent() will retrieve a system variable, and the input for it is WHICH system variable you want to retrieve.

GetCurrent("MyDocuments") will return the path to your Documents, GetCurrent("Height") will return the height of the main window etc. 

GetFileName() will need the string representation of the Path as Argument 3. 

SetValue("path_Documents",GetFileName("","",GetCurrent(GetVAr("pathDocuments")))))

GetCurrent(GetVAr("pathDocuments")) makes no meaning as it will return BLANK.

Simply: GetFileName("","",GetVAr("pathImagens")) will give you the result you are looking for.


Written by DataEase 19/05/15 at 08:53:07 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:Re:GetFileName problem

Sorry, but after making the changes you sugest, the results are the same.

It works "sometimes"


Written by afonso santos 19/05/15 at 22:31:41 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:Re:Re:GetFileName problem

Then your problem is that you for some reason don't get an existing path etc in your parameters.

I also saw that you have too many end parentheses, that might affect something.

We use this function all the time and have had no problems at all, it is also a function that is close to 20 years old without any reported problems so the problem is almost guaranteed in your code and not the function. 

Build it from scratch and see if you get the same problem.


Written by DataEase 20/05/15 at 07:41:08 Dataease [{8}]FIVE
DG3_ForumList