fischex

package module
v0.0.0-...-c1f4067 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 6 Imported by: 0

README

Fischex

About Cabarrus County

Cabarrus is an ever-growing county in the southcentral area of North Carolina. Cabarrus is part of the Charlotte/Concord/Gastonia NC-SC Metropolitan Statistical Area and has a population of about 210,000. Cabarrus is known for its rich stock car racing history and is home to Reed Gold Mine, the site of the first documented commercial gold find in the United States.

About our team

The Business & Location Innovative Services (BLIS) team for Cabarrus County consists of five members:

  • Joseph Battinelli - Team Supervisor
  • Mark McIntyre - Software Developer
  • Landon Patterson - Software Developer
  • Brittany Yoder - Software Developer
  • Marci Jones - Software Developer

Our team is responsible for software development and support for the County. We work under the direction of the Chief Information Officer.

About

Fischex is a Playwright Client built in Go for turning Excel files into Laserfiche forms. At Cabarrus County, we use Laserfiche variables mostly as a way to collect data from an enhanced front end(I.E. either bootstrap inputs, chatbots, etc), the variables that are collected are usually repetitive and used only for transferring data in the forms lifecycle. Having the ability to edit the forms in excel gives us the ability to use iterators, etc, and all the power that excel offers(Find replace, etc).

Download the package

go get github.com/CabarrusCo/fischex
Spin up a new client

When spinning up a new client, you must pass the URL of your forms home screen as a parameter, as well as wether or not you want to run the browser in headless mode or not.

	fx, err := fischex.NewFischeXClient("https://formsserver/forms/", false)
	if err != nil {
		fmt.Println(err)
		return
	}
Logging in

After spinning up a new client, you have to instruct Fischex to login. It's up to you to store your credentials securely.

	username := "MySercurelyStoredUsername"
	password := "MySecurelyStoredPassword"

	err = fx.Login(username, password)
	if err != nil {
		fmt.Println(err)
		return
	}
Converting Excel to a form

After logging in, you can then convert excel to a form using the ConvertExcel function. The ConvertExcel function takes three parameters, the form URL, the path to the Excel file, and a wait time pause. Use the wait time pause only if you want to slow things down when running headless mode false. Example

	err = fx.ConvertExcel("https://formsserver/Forms/design/layout/540", `C:\form.xlsx`, 0)
	if err != nil {
		fmt.Println(err)
		return
	}
Stopping the instance

After the Excel is converted, you can stop the instance by using the Stop function.

	err = fx.Stop()
	if err != nil {
		fmt.Println(err)
		return
	}
Full working example
package main

import (
	"fmt"
	"os"

	"github.com/CabarrusCo/fischex"
)

func main() {
	fx, err := fischex.NewFischeXClient("https://formsserver/forms/", false)
	if err != nil {
		fmt.Println(err)
		return
	}

	username := "MySecurelyStoredUsername"
	password := "MySecurelyStoredPassword"

	err = fx.Login(username, password)
	if err != nil {
		fmt.Println(err)
		return
	}

	err = fx.ConvertExcel("https://formserver/Forms/design/layout/540", `C:\form.xlsx`, 0)
	if err != nil {
		fmt.Println(err)
		return
	}

	err = fx.Stop()
	if err != nil {
		fmt.Println(err)
		return
	}

}
The Excel file

Currently, the Excel file must be structured a specific way. The first row must be headers. The fields in the Excel file are Label Name, Variable Name, Class Name, Type, Multi Line height, Options, Iteration. Only Excel 2007 and later is supported.

Using Iteration

You can use the iteration feature to create data sets off one row. To do that, set the iterator number in the iterator cell to a number, then use ${i} to inject the iterator.

Sample excel files

Two sample excel files have been added into this repo as an example

Other

This project is still in it's infancy stages. Please check back often for updates as we find/address issues!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FischeX

type FischeX struct {
	// contains filtered or unexported fields
}

func NewFischeXClient

func NewFischeXClient(url string, headless bool) (*FischeX, error)

func (FischeX) ConvertExcel

func (f FischeX) ConvertExcel(formURL string, excelPath string, pauseSleep int) error

func (FischeX) Login

func (f FischeX) Login(username string, password string) error

func (FischeX) Stop

func (f FischeX) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL