0

Need Help with view table.

Fred

I have the this formula and works excellent, I can search by Name and Dates at the same time. (Two search), but I will like the view table appears without information when I open the search table. Is possible.?

let me := this;
let myS := "";
myS := myS + if Search then "N" else "_" end;
myS := myS + if Date_From then "V" else "_" end;
myS := myS + if Date_To then "B" else "_" end;
switch myS do
case "NVB":
    (select Data)[contains(Nombre, me.Search) and FECHA >= me.Date_From and FECHA <= me.Date_To]
case "NV_":
    (select Data)[contains(Nombre, me.Search) and FECHA >= me.Date_From]
case "N_B":
    (select Data)[contains(Nombre, me.Search) and FECHA <= me.Date_To]
case "N__":
    (select Data)[contains(Nombre, me.Search)]
case "_VB":
    (select Data)[FECHA >= me.Date_From and FECHA <= me.Date_To]
case "_V_":
    (select Data)[FECHA >= me.Date_From]
case "__B":
    (select Data)[FECHA <= me.Date_To]
case "___":
    (select Data)
end

 

Copy

 

Copy

16 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    One way is to hide the view until there is something in the search fields.

    Another way is in the switch command there is a “default” case, so you can try putting null in there.

    case default:
    null
    end
    

    i don’t know if Ninox will accept this. If it doesn’t then you can put in a search that you know will always return an empty set.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      Fred Thanks I will try with the first options.👍

    • Mel_Charles
    • 1 yr ago
    • Reported - view

    Fred / Rafael- I could not ever get this to work with either Null nor " "

    (obviously hide form view - will work) but I want to leave the grid visible at all times

    I did get around it by piping a period into one of my search boxes (form script in my button) 

     

    sample show 2 x search boxes (item and ref) with period

    and without period

    a bit crude but ....

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      Mel Charles Bit Crude but work great.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      Mel Charles how would it be the script in the  button ?

      • Mel_Charles
      • 1 yr ago
      • Reported - view

      Rafael so in my table above there are 2 fields that work  together to filter the data in the table view. (Search Items and Search Ref)

      so in the clear button for my example you only need

      'Search Item' := ".";
      'Search Ref' := "."

      to pipe a period into both boxes (or just do one of them would also work)

      I wish it were more complicated but alas ... it is not! :-)

       

      bear in mind this would fail if you have a period store in the data fields (which i don't) so you could use any text item like a pling ! etc

       

      i just used a period cos it is small and insignificant and i can be sure it is never in any of my key fey search fields

    • Mel_Charles
    • 1 yr ago
    • Reported - view

    To be honest - it has just dawned on me that this really is only another way of saying show hide the form. The only difference is that you either see the grid or not - so you could go on to display a table place holder like an image!!

    So probably a better way is to use a yes/no option "checkbox" (DisplayFlag) option instead of the button and set the table view "show display if" option to DisplayFlag = true (or false if you want flag the other way around!

    You could go on further to have the search field - trigger after update set the flag. and use another field to reset the same flag. you can't your for trigger.

    you can't use the form trigger after update as this would instantly close the option as soon as it was opened which would be no good.

    Wouldn't it be great if we had a trigger on form open and close !!! with out any modification taking place?

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      Mel Charles Excelent explained Thank Mel 

    • Alain_Fontaine
    • 1 yr ago
    • Reported - view

    When no search field is filled, this option is selected:

    case "___":
        (select Data)
    

    You could try:

    case "___":
        (select Data)[false]
    • Rafael Sanchis
    • Rafael_Sanchis
    • 1 yr ago
    • Reported - view

    Alain Fontaine This work perfect, Thanks Alain, appreciate.

    • Rafael Sanchis
    • Rafael_Sanchis
    • 1 yr ago
    • Reported - view

    I try with this Formula sum the hours in Data Table for the people, I place in the Search field.

    But don't work any idea.?

    let search := lower(Search);
    select Data where number(HORAS) = search
    
    • Fred
    • 1 yr ago
    • Reported - view

    I try with this Formula sum the hours in Data Table for the people, I place in the Search field.

    But don't work any idea.?

    let search := lower(Search);
    select Data where number(HORAS) = search
    

    In line 1, the lower(Search) implies text is involved. What kind of field is Search?

    In Line 2 you are using number(HORAS), which implies you will get a number back. So you can't compare the two.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      Fred 

      Hi Fred.

      The Search field is a Text. For search Name.

      I need to know the hours spend on Data table for name place on  the Search field.

    • Fred
    • 1 yr ago
    • Reported - view
    Rafael said:
    I need to know the hours spend on Data table for name place on  the Search field.

     What is the name of the field that holds the name place? Use that.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      Fred Hi Fred

      I send the DB 

      In the Search Table is where I have the field Search and the other Two Date From and Date To. Here I have the Formula2 that don't work.

      The Data is where I have all Date, Name Rate etc.

    • Fred
    • 1 yr ago
    • Reported - view

    Since you are looking for people's name you need to use the field that stores the people's name. I'm guessing HORAS does not store people's name. Looking at your structure you need to use the following code in Formula 2.

    let search := lower(Search);
    let x := (select Data)[lower(STAFF.Nombre) like search];
    concat(x)
    

    plus since you are probably not typing in a person's full name you should probably use like instead of =.

    If you want to put this in your view then you can remove the let x and the concat as these are only for display purposes.

Content aside

  • 1 yr agoLast active
  • 16Replies
  • 203Views
  • 4 Following